Index of Section 3 Manual Pages
| Interix / SUA | qsort.3 | Interix / SUA |
qsort(3) qsort(3)
qsort()
NAME
qsort() - sort function
SYNOPSIS
#include
void qsort (void *base, size_t nmemb, size_t size,
int (*compar)(const void *, const void *) )
DESCRIPTION
The qsort(3) function is a modified partition-exchange sort, or quicksort.
The qsort(3) function sorts an array of nmemb objects, the initial member
of which is pointed to by base. The size of each object is specified by
size.
The contents of the array base are sorted in ascending order according to
a comparison function pointed to by compar, which requires two arguments
pointing to the objects being compared.
The comparison function must return an integer less than, equal to, or
greater than zero if the first argument is considered to be respectively
less than, equal to, or greater than the second.
Qsort(3) is not stable, that is, if two members compare as equal, their
order in the sorted array is undefined. While qsort(3) does not allocate
memory, it is implemented using recursion.
RETURN VALUES
The qsort(3) function returns no value.
SEE ALSO
sort(1)
USAGE NOTES
The qsort function is thread safe.
The qsort function is not async-signal safe.