*** UNIX MANUAL PAGE BROWSER ***

A Nergahak database for man pages research.

Navigation

Directory Browser

1Browse 4.4BSD4.4BSD
1Browse Digital UNIXDigital UNIX 4.0e
1Browse FreeBSDFreeBSD 14.3
1Browse MINIXMINIX 3.4.0rc6-d5e4fc0
1Browse NetBSDNetBSD 10.1
1Browse OpenBSDOpenBSD 7.7
1Browse UNIX v7Version 7 UNIX
1Browse UNIX v10Version 10 UNIX

Manual Page Search

Manual Page Result

0 Command: bsearch | Section: 3 | Source: Digital UNIX | File: bsearch.3.gz
bsearch(3) Library Functions Manual bsearch(3) NAME bsearch - Performs a binary search LIBRARY Standard C Library (libc.so, libc.a) SYNOPSIS #include <stdlib.h> void *bsearch( const void *key, const void *base, size_t nmemb, size_t size, int (*compar)(const void *, const void *)); STANDARDS Interfaces documented on this reference page conform to industry stan- dards as follows: bsearch(): XPG4, XPG4-UNIX Refer to the standards(5) reference page for more information about in- dustry standards and associated tags. PARAMETERS Target of search. Points to the initial object in the array. Speci- fies the number of elements in the array. Specifies the byte size of each element of the array. Points to the comparison function, which is called with two parameters that point to the key object and to an array member, in that order. DESCRIPTION The bsearch() function does a binary search and returns a pointer in an array that indicates where an object is found. The compar comparison function is called with two parameters that point to objects that are compared during the search. This function returns an integer less than, equal to, or greater than 0 (zero) depending whether the object pointed to by the key parameter is considered to be less than, equal to, or greater than the array element. NOTES [Digital] The bsearch() function is reentrant, but care should be taken to ensure that the function supplied as argument compar is also reentrant. RETURN VALUES Upon successful completion, the bsearch() function returns a pointer to a matching object in the array. A NULL is returned when no match is found. When two or more objects compare equally, the returned object is unspecified. RELATED INFORMATION Functions: hsearch(3), lsearch(3), qsort(3), tsearch(3) Standards: standards(5) delim off bsearch(3)

Navigation Options