VecSort
- Macro
- October 8, 2025
Table of Contents
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)
- 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
- 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;
}