C Language and Libraries Help (clang.hlp) (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
qsort
 Summary Example                         Up Contents Index Back
─────Run-Time Library───────────────────────────────────────────────────────
 
     The qsort function implements a quick-sort algorithm to sort an
     array of <num> elements, each of <width> bytes. The <base>
     argument is a pointer to the base of the array to be sorted. The
     qsort function overwrites this array with the sorted elements.
 
     The <compare> argument is a pointer to a user-supplied routine
     that compares two array elements and returns a value specifying
     their relationship. The qsort function calls the compare routine
     one or more times during the sort, passing pointers to two array
     elements on each call:
 
          compare( (void*) elem1, (void*) elem2 );
 
     The routine must compare the elements, then return one of the
     following values:
 
     Value     Meaning
 
     < 0       <elem1> less than <elem2>
     = 0       <elem1> equivalent to <elem2>
     > 0       <elem1> greater than <elem2>
 
     The array is sorted in increasing order, as defined by the compare
     function. To sort an array in decreasing order, reverse the sense
     of "greater than" and "less than" in the compare function.
 
     Return Value
 
     None.
                                    -♦-