QSORT(S) XENIX System V QSORT(S)
Name
qsort - Performs a quicker sort.
Syntax
void qsort (base, nel, width, compar)
char *base;
unsigned nel, width;
int (*compar)( );
Description
qsort is an implementation of the quicker-sort algorithm.
The first argument is a pointer to the base of the data; the
second is the number of elements; the third is the width of
an element in bytes; the last is the name of the comparison
routine. It is called with two arguments which are pointers
to the elements being compared. The routine must return an
integer less than, equal to, or greater than 0 according to
how much the first argument is to be considered less than,
equal to, or greater than the second.
Notes
The pointer to the base of the table should be of type
pointer-to-element, and cast to type pointer-to-character.
The comparison function need not compare every byte, so
arbitrary data may be contained in the elements in addition
to the values being compared.
The order in the output of two items which compare as equal
is unpredictable.
See Also
bsearch(S), lsearch(S), sort(C), string(S)
Page 1 (printed 8/7/87)