Tag Archives: Quick Sort

void qsort(void *base, size_t nel, size_t width, int (*compar)(const void *, const void *));
■base — is a pointer to the beginning of data array
■nel — is a number of elements
■width — is a size of each element (in bytes)
■compar — is a callback function (pointer to function), which does comparison and returns positive or negative integer depending on result.

This example contains three separate functions sort_integers_example(), sort_cstrings_example() and sort_structs_example().