![]() |
![]()
| ![]() |
![]()
NAMExt_long_long_cmp() - Compare two long longs for qsort(3), bsearch(3), etc. LIBRARY#include <xtend/math.h> -lxtend SYNOPSISint xt_long_long_cmp(const long long *n1, const long long *n2) ARGUMENTSn1, n2 Pointers to two long long values DESCRIPTIONThis is a function that compares two long longs as a service to polymorphic functions such as qsort(3), bsearch(3), etc. The address of xt_long_long_cmp() is passed as an argument to perform the data type specific comparison on behalf of the sort of search function. RETURN VALUESA value > 0 if *n1 is greater than *n2 A value < 0 if *n1 is less than *n2 0 if the values are equal EXAMPLESlong long list[LIST_SIZE]; // sizeof(*list) will continue to work if we change the data type // We'll still need to change the cmp function, though qsort(list, LIST_SIZE, sizeof(*list), SEE ALSOqsort(3), heapsort(3), mergesort(3), bsearch(3)
|