INtime SDK Help
qsort

Performs a quick sort of an array, overwriting the input array with the sorted elements.

#include <stdlib.h>
#include <search.h>

void qsort (void *base, size_t num, size_t width,
            int (*compare)(const void *elem1, const void *elem2));

Parameters

base
Pointer to the base of the array you want to sort and overwrite.
num
Array size in number of elements.
width
Element size in bytes.
compare
Pointer to a user-supplied routine that compares two array elements (elem1 and elem2) and returns a value specifying their relationship:
< 0 elem1 less than elem2
= 0 elem1 equivalent to elem2
> 0 elem1 greater than elem2
elem1
Pointer to the key for the sort.
elem2
Pointer to the array element to compare with the key.

Remarks

qsort 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 function sorts the array in ascending order, as defined by the compare routine. To sort the array in descending order, reverse the sense of greater-than and less-than in the compare routine.

Requirements

Versions Defined in Include Link to
INtime 3.0 intime/rt/include/stdlib.h stdlib.h
search.h
clib.lib

See Also

bsearch, lsearch