void QSort(arrayp, n, elmtSize, compareProcP());
Sorts an array of an arbitrary data type using the QuickSort algorithm. In addition to passing the array you want to sort to this routine, you also pass a comparison procedure that this sort routine then uses to compare elements in the array.
The comparison routine should return a number less than zero if a is less than b, zero if a is equal to b, and a number greater than zero if a is greater than b.
You should declare the comparison routine to have the following parameters and return type:
int32 compareProcP(UPtr a, UPtr b);
Name | Type | Description |
---|---|---|
arrayp | UPtr | Pointer to an array of data. |
n | int32 | Number of elements in the array you want to sort. |
elmtSize | int32 | Size in bytes of an array element. |
compareProcP | CompareProcPtr | Comparison routine you want QSort to use to compare array elements. QSort passes this routine the addresses of two elements that it needs to compare. |