qsort()
Library Functionqsort()
that
performs a Quick Sort on an array.
void qsort(void* base, size_t nmemb, size_t size,
int (*compar) (const void*, const void*));
where
base
is the address of the first element of the array.
nmemb
is the number of members in the array.
size
is the number of bytes in a single array element.
compar()
is a function that compares two array elements.
compar()
returns
compar()
must define a total order on the objects in the class.
a
, b
, c
, the following
properties hold:
a <= a
.
a <= b
and b <= a
,
then a == b
.
a <= b
and b <= c
,
then a <= c
.
a < b
or a == b
or a > b
.
This page was last modified on Apr 23, 2001
URL: http://people.hsc.edu/faculty-staff/robbk/Coms262/Lectures/TheqsortFunction.html