QSORT(3) NEWLIB QSORT(3)NAME
2.31 `qsort'--sort an array
SYNOPSIS
#include <stdlib.h>
void qsort(void *BASE, size_t NMEMB, size_t SIZE,
int (*COMPAR)(const void *, const void *) );
DESCRIPTION
`qsort' sorts an array (beginning at BASE) of NMEMB objects. SIZE
describes the size of each element of the array.
You must supply a pointer to a comparison function, using the argu‐
ment shown as COMPAR. (This permits sorting objects of unknown proper‐
ties.) Define the comparison function to accept two arguments, each a
pointer to an element of the array starting at BASE. The result of
`(*COMPAR)' must be negative if the first argument is less than the
second, zero if the two arguments match, and positive if the first
argument is greater than the second (where "less than" and "greater
than" refer to whatever arbitrary ordering is appropriate).
The array is sorted in place; that is, when `qsort' returns, the
array elements beginning at BASE have been reordered.
RETURNS
`qsort' does not return a result.
PORTABILITY
`qsort' is required by ANSI (without specifying the sorting algorithm).
SEE ALSOqsort is part of the library. The full documentation for is maintained
as a Texinfo manual. If info and are properly installed at your site,
the command
info
will give you access to the complete manual.
NEWLIB April 2010 QSORT(3)