The information in this article applies to:
SUMMARY
When you define or prototype a comparison function for the run-time library
function qsort(), the formal parameters should be of type "const void *"
because qsort() doesn't know the type of data that it is dealing with.
Internally, qsort() is dealing with void pointers only. The const directive
is there because the compare routine shouldn't modify the values that are
being compared. Inside of your compare routine, you must cast the void
pointers back to pointers of the correct type.
where ELEMENT_TYPE is the type of the array elements, then the function for
comparison should be prototyped as follows:
Additional query words:
Keywords : kbCRT kbVC100 kbVC150 kbVC200 kbVC400 kbVC500 kbVC600 |
Last Reviewed: July 1, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |