<snip>
>> double prices[]={24.45,24,21};
<snip>
> /* in the main function */
>
> qsort(prices, 3, sizeof(double), compdoubles);
It's almost always better to write
qsort(prices, 3, sizeof *prices, compdoubles);
in these cases. When the type has been lost, you can't do this, of
course, but if you can, I can't see any reason not to.
The gain is small since you usually can't change the array type without
having to make other changes to the qsort call, but it still saves the
reader a millisecond or two of checking that the size, at least, is
right.
[In this case the 3 can also be replaced, but that it less common in
real code.]
--
Ben.