qsortex
The FSF.qsortex function allows to sort an array of any
type of data using the QuickSort algorithm. Unlike the qsort
function, it allows to pass user-defined data to the compare function.
void WINAPI qsortex( void *Base, size_t NElem, size_t Width, int (__cdecl *fcmp)(const void *, const void *, void *), void *User );
Parameters
Base
Start of target array.
NElem
Array size in elements.
Width
The size of each element in bytes.
fcmp
User-defined comparison function that must be declared with __cdecl - C-style
calling convention. This function takes three arguments - elem1,
elem2 (the pointers to the array of elements) and user
(user-defined data passed in the User argument to the qsortex function).
fcmp function must compare elem1 and elem2 elements
and return an integer value:
*elem1 < *elem2 | - fcmp returns value < 0 |
*elem1 == *elem2 | - fcmp returns value == 0 |
*elem1 > *elem2 | - fcmp returns value > 0 |
User
User-defined data passed as the third parameter to the comparison function.
Return value
None.
Remarks
The sort implemented by the qsort and qsortex
functions is not stable. In other words, the order for the elements that
are equal according to the compare function is not defined. The order
can change when the array is sorted repeatedly.
See also: