VecSort
VecSort
Description
Sort given vector with given comparator using quicksort algorithm.
Parameters
| Name | Direction | Description |
|---|---|---|
v |
in,out | Vector to be sorted. |
compare |
in | Compare function. Signature and behaviour must be similar to that of ZstrCompare. |
Success
return
Failure
Does not return
Usage example (Cross-references)
Usage examples (Cross-references)
- In
Str.c:418:
case STR_SORT : {
VecSort(str, NULL); // Use default comparison
break;
}- In
VecInt.c:300:
// Advanced functions
case VEC_INT_SORT : {
VecSort(vec, compare_ints);
break;
}- In
Vec.Ops.c:117:
// Test VecSort function
bool test_vec_sort(void) {
WriteFmt("Testing VecSort\n");
// Create a vector of integers
- In
Vec.Ops.c:130:
// Sort the vector in ascending order
VecSort(&vec, compare_ints_asc);
// Check that the elements are sorted
- In
Vec.Ops.c:140:
// Sort the vector in descending order
VecSort(&vec, compare_ints_desc);
// Check that the elements are sorted in descending order
Last updated on