3 <<qsort_r>>---sort an array
11 void qsort_r(void *<[base]>, size_t <[nmemb]>, size_t <[size]>,
13 int (*<[compar]>)(void*, const void *, const void *));
17 void qsort_r(void *<[base]>, size_t <[nmemb]>, size_t <[size]>,
18 int (*<[compar]>)(const void *, const void *, void *),
22 <<qsort_r>> sorts an array (beginning at <[base]>) of <[nmemb]> objects.
23 <[size]> describes the size of each element of the array.
25 You must supply a pointer to a comparison function, using the argument
26 shown as <[compar]>. (This permits sorting objects of unknown
27 properties.) There are two forms of this function, in each the
28 comparison function is defined to accept three arguments, but in a
29 different order. Two are pointers to an element of the array starting at
30 <[base]>, and another being an arbitrary pointer <[thunk]>. The
31 result of <<(*<[compar]>)>> must be negative if the first argument is
32 less than the second, zero if the two arguments match, and positive if
33 the first argument is greater than the second (where ``less than'' and
34 ``greater than'' refer to whatever arbitrary ordering is appropriate).
36 The array is sorted in place; that is, when <<qsort_r>> returns, the
37 array elements beginning at <[base]> have been reordered.
40 <<qsort_r>> does not return a result.
43 <<qsort_r>>, in various forms, appears in both BSD and glibc.
47 #define I_AM_GNU_QSORT_R