bsearch(3C)
_________________________________________________________________
bsearch function
Search an array.
_________________________________________________________________
Calling Sequence
void *bsearch();
const void *base, *key;
unsigned count, size;
int (*compar)(const void *, const void *);
...
bsearch(key, base, count, compar);
Description
The function bsearch searches an array of count elements whose
first element is pointed to by base for a member that matches the
object pointed to by key. The size of each element is specified
by size.
The contents of the array will be sorted in ascending order by a
comparison function pointed to by compar, which is called with
two arguments that point to the key object and to an array
member. The comparison function will return an integer less than
zero if the key object is less than the array member, greater
than zero if the key object is greater than the array member, or
0 if the key object matches the array member.
Returns
The function bsearch returns a pointer to the matching member of
the array; if two members match the array member, this function
does not specify which member it points to. If no match is
found, a null pointer is returned.
DG/UX 4.00 Page 1
Licensed material--property of copyright holder(s)