Sorts the values in an array using a given comparison function.
- iOS 2.0+
- macOS 10.0+
- Mac Catalyst 13.0+Beta
- tvOS 9.0+
- watchOS 2.0+
- Core Foundation
The array whose values are sorted.
The range of values within
theto sort. The range location or end point (defined by the location plus length minus 1) must not lie outside the index space of
Nis the count of
the). The range length must not be negative. The range may be empty (length 0).
The function with the comparator function type signature that is used in the sort operation to compare the values in
the. If this parameter is not a pointer to a function of the correct prototype, the behavior is undefined. If there are values in
comparatorfunction does not expect or cannot properly compare, the behavior is undefined. The values in the range are sorted from least to greatest according to this function.
A pointer-sized program-defined value, which is passed as the third parameter to the
comparatorfunction, but is otherwise unused by this function. If the context is not what is expected by the
comparatorfunction, the behavior is undefined.