Function bsearch_iter
Defined in File search.h
Function Documentation
-
int bsearch_iter(const void *a, const void *e, int (*cmpe)(const void *e1, const void *e2), size_t el_size, int low, int high)
Search a sorted array of data using binary search, iterative version.
The array is assumed to already be sorted.
- Parameters:
a – The array to search
e – The element to search for
cmpe – Callback to compare two elements
el_size – Size of elements in bytes
low – Lowest index in the array to consider when searching. This should usually be 0.
high – Highest index in the array to consider when searching. This should usually be max index of the array.
- Returns:
The index, or -1 if not found or an ERROR occurred