1 /* File : example.c */
\r
5 /* we are using the qsort function, which needs a helper function to sort */
\r
6 int compare_int(const void * a, const void * b)
\r
8 return ( *(int*)a - *(int*)b );
\r
11 void sort_int(int* arr, int len)
\r
13 qsort(arr, len, sizeof(int), compare_int);
\r
17 int compare_double(const void * a, const void * b)
\r
19 return (int)( *(double*)a - *(double*)b );
\r
22 void sort_double(double* arr, int len)
\r
24 qsort(arr, len, sizeof(double), compare_double);
\r