
------------------------------------------------------------------------------
7.12 Perform quick sort. <Main,Alarm,Comm>
------------------------------------------------------------------------------
[Name]
qsort
[Syntax]
#include <stdlib.h>
void qsort( const void *base, size_t nmemb, size_t size,
int (*compar)( const void *, const void *) ) ;
[Arguments]
base Pointer to the top of the array (its order will be
changed by sorting.)
nmemb Element number of the array.
size Size of an element of the array.
compar Pointer to the user definition function which
compares two elements.
[Return]
------
[Description]
Performs quick sorting of the specified array. "qsort" function
calls "compar" function for searching. The return value of "compar"
function must follow the following rule.
Return Comparison result
-----------------+---------------------------
less than 0 1st arg. < 2nd arg.
equal to 0 1st arg. = 2nd arg.
greater than 0 1st arg. > 2nd arg.