qc.hlp (Table of Contents; Topic list)
qsort
 Summary Example                         Up Contents Index Back
────────────────────────────────────────────────────────────────────────────
 
     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
 
     Less than 0        <elem1> less than <elem2>
     0                  <elem1> equivalent to <elem2>
     Greater than 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.
                                    -♦-