STL Sort
sort()
algorithm
header
Usage
Reverse
Use <functional>
header and std::greater
Src
sort( &arr[0], &arr[n], greater<int>() )
or any boolean return function Queue
qsort()
stdlib.h
header
Usage
void qsort(void *base, size_t nitems, size_t size, int (*compar)(const void *, const void*))
-
base − This is the pointer to the first element of the array to be sorted.
-
nitems − This is the number of elements in the array pointed by base.
-
size − This is the size in bytes of each element in the array.
-
compar − This is the function that compares two elements. Return INT
-
example