Sorts a table of data in place.
Standard C Library (libc.a)
#include <stdlib.h>
void qsort (Base, NumberOfElements, Size, ComparisonPointer)
void * Base;
size_t NumberOfElements, Size;
int (*ComparisonPointer)(const void*, const void*);
The qsort subroutine sorts a table of data in place. It uses the quicker-sort algorithm.
Item | Description |
---|---|
Base | Points to the element at the base of the table. |
NumberOfElements | Specifies the number of elements in the table. |
Size | Specifies the size of each element. |
ComparisonPointer | Points to the comparison function, which is passed two parameters that point to the objects being compared. The qsort subroutine sorts the array in ascending order according to the comparison function. |
The comparison function compares its parameters and returns a value as follows:
Because the comparison function need not compare every byte, the elements can contain arbitrary data in addition to the values being compared.
The pointer to the base of the table should be of type pointer-to-element, and cast to type pointer-to-character.