[alg.c.library] # 26 Algorithms library [[algorithms]](./#algorithms) ## 26.13 C library algorithms [alg.c.library] [1](#1) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/algorithms.tex#L14449) [*Note [1](#note-1)*: The header [](cstdlib.syn#header:%3ccstdlib%3e "17.2.2 Header synopsis [cstdlib.syn]") declares the functions described in this subclause[.](#1.sentence-1) — *end note*] [🔗](#lib:bsearch) `void* bsearch(const void* key, void* base, size_t nmemb, size_t size, c-compare-pred* compar); void* bsearch(const void* key, void* base, size_t nmemb, size_t size, compare-pred* compar); const void* bsearch(const void* key, const void* base, size_t nmemb, size_t size, c-compare-pred* compar); const void* bsearch(const void* key, const void* base, size_t nmemb, size_t size, compare-pred* compar); void qsort(void* base, size_t nmemb, size_t size, c-compare-pred* compar); void qsort(void* base, size_t nmemb, size_t size, compare-pred* compar); ` [2](#2) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/algorithms.tex#L14471) *Preconditions*: For qsort, the objects in the array pointed to by base are of trivially copyable type[.](#2.sentence-1) [3](#3) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/algorithms.tex#L14476) *Effects*: These functions have the semantics specified in the C standard library[.](#3.sentence-1) [4](#4) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/algorithms.tex#L14480) *Throws*: Any exception thrown by compar ([[res.on.exception.handling]](res.on.exception.handling "16.4.6.14 Restrictions on exception handling"))[.](#4.sentence-1) See also: ISO/IEC 9899:2024, 7.24.5