General utilities library. More...
#include <core.h>
Go to the source code of this file.
Typedefs | |
typedef int(* | sortcmp) (const void *a, const void *b) |
Comparison function pointer type for use with the qsort function. More... | |
Functions | |
void | qsort (void *base, size_t num, size_t size, sortcmp cmp) |
Sort the elements of an array using a sort comparison function. More... | |
General utilities library.
Definition in file stdlib.h.
typedef int(* sortcmp) (const void *a, const void *b) |
Comparison function pointer type for use with the qsort function.
[in] | a | Pointer to first element to be compared. |
[in] | b | Pointer to second element to be compared. |
0 if the elements sort equivalently.
>0 if the element pointed to by a should go after the element pointed to by b.
void qsort | ( | void * | base, |
size_t | num, | ||
size_t | size, | ||
sortcmp | cmp | ||
) |
Sort the elements of an array using a sort comparison function.
Sorts a contiguous array of num elements pointed to by base, where each element is size bytes long.
[in] | base | Pointer to the first element in the array. |
[in] | num | Number of element in the array to be sorted. |
[in] | size | Size of each element in bytes. |
[in] | cmp | Pointer to a function that compares two elements. |
Referenced by kshell(), and normalize().