This quicksort is supposed to sort \"v[left]...v[right] into increasing order\"; copied (without comments) from The C Programming Language by K&R (Second Edition):
You aren't imagining an array with INT_MAX
number of elements, are you?
Yes, you're right, although it's possibly just written that way for simplicity -- it's an example after all, not production code.
Yes, you're right. You can use left - (left - right) / 2
to avoid overflows.
K&R was always a bit sloppy with their use of unsigned vs signed arguments. Side effect of working with a PDP that had only 16 kilobytes of memory I suppose. That's been fixed a while ago. The current definition of qsort is
void qsort(
void *base,
size_t num,
size_t width,
int (__cdecl *compare )(const void *, const void *)
);
Note the use of size_t instead of int. And of course void* base since you don't know what kind of type you are sorting.