Standard C defines the function bsearch, which performs a binary search on an array of elements. The function bsearch is very efficient, but it works only on sorted arrays. You can use the function qsort to sort a non-sorted array first, and then use bsearch to perform a binary search on the sorted array. Both functions are declared in the header file