bsearch searches a sorted array through a caller-provided comparison function. It receives the key, array base, element count, element size, and comparator; the untyped base pointer makes the interface generic. section 11.4
typedef int compare_function(void const*, void const*);
void* bsearch(void const* key, void const* base,
size_t n, size_t size,
compare_function* compar);
void qsort(void* base,
size_t n, size_t size,
compare_function* compar);
!@%STYLE%@!
{"css":"{\"css\": \"font-weight: bold;\"}","target":"[[{\"line\":0,\"ch\":0},{\"line\":0,\"ch\":11}],[{\"line\":0,\"ch\":29},{\"line\":0,\"ch\":39}],[{\"line\":2,\"ch\":14},{\"line\":2,\"ch\":24}],[{\"line\":0,\"ch\":29},{\"line\":0,\"ch\":39}],[{\"line\":2,\"ch\":14},{\"line\":2,\"ch\":24}],[{\"line\":0,\"ch\":29},{\"line\":0,\"ch\":33}],[{\"line\":2,\"ch\":0},{\"line\":2,\"ch\":4}],[{\"line\":6,\"ch\":0},{\"line\":6,\"ch\":4}],[{\"line\":2,\"ch\":6},{\"line\":2,\"ch\":13}],[{\"line\":0,\"ch\":29},{\"line\":0,\"ch\":39}],[{\"line\":2,\"ch\":14},{\"line\":2,\"ch\":24}],[{\"line\":0,\"ch\":29},{\"line\":0,\"ch\":39}],[{\"line\":2,\"ch\":14},{\"line\":2,\"ch\":24}],[{\"line\":3,\"ch\":14},{\"line\":3,\"ch\":20}],[{\"line\":7,\"ch\":11},{\"line\":7,\"ch\":17}],[{\"line\":3,\"ch\":14},{\"line\":3,\"ch\":20}],[{\"line\":7,\"ch\":11},{\"line\":7,\"ch\":17}],[{\"line\":0,\"ch\":29},{\"line\":0,\"ch\":33}],[{\"line\":2,\"ch\":0},{\"line\":2,\"ch\":4}],[{\"line\":6,\"ch\":0},{\"line\":6,\"ch\":4}],[{\"line\":6,\"ch\":5},{\"line\":6,\"ch\":10}],[{\"line\":0,\"ch\":29},{\"line\":0,\"ch\":33}],[{\"line\":2,\"ch\":0},{\"line\":2,\"ch\":4}],[{\"line\":6,\"ch\":0},{\"line\":6,\"ch\":4}],[{\"line\":3,\"ch\":14},{\"line\":3,\"ch\":20}],[{\"line\":7,\"ch\":11},{\"line\":7,\"ch\":17}],[{\"line\":3,\"ch\":14},{\"line\":3,\"ch\":20}],[{\"line\":7,\"ch\":11},{\"line\":7,\"ch\":17}]]"}
!@%STYLE%@!
The declaration makes the essential contract visible: bsearch operates through void pointers and size parameters, while compar supplies the element ordering. section 11.4
A safe comparison function
A comparator for unsigned elements casts the two void pointers, then returns -1, 0, or +1 according to their ordering. Do not replace these tests with `return *A - *B`: integer subtraction can overflow when the values are far apart. section 11.4 section 11.4

