Penguin
Annotated edit history of lsearch(3) version 1, including all changes. View license author blame.
Rev Author # Line
1 perry 1 LSEARCH
2 !!!LSEARCH
3 NAME
4 SYNOPSIS
5 DESCRIPTION
6 RETURN VALUE
7 SEE ALSO
8 ----
9 !!NAME
10
11
12 lfind, lsearch - linear search of an array.
13 !!SYNOPSIS
14
15
16 __#include
17 __''key''__, const void *__''base''__, size_t *__''nmemb''__,
18 size_t__ ''size''__, int (*__''compar''__)(const void *, const void *));
19 void *lsearch(const void *__''key''__, void *__''base''__, size_t *__''nmemb''__,
20 size_t__ ''size''__, int (*__''compar''__)(const void *, const void *));
21 __
22 !!DESCRIPTION
23
24
25 __lfind()__ and __lsearch()__ perform a linear search
26 for ''key'' in the array ''base'' which has
27 *''nmemb'' elements of ''size'' bytes each. The
28 comparison function referenced by ''compar'' is expected
29 to have two arguments which point to the ''key'' object
30 and to an array member, in that order, and which returns
31 zero if the ''key'' object matches the array member, and
32 non-zero otherwise.
33
34
35 If __lsearch()__ does not find a matching element, then
36 the ''key'' object is inserted at the end of the table,
37 and *''nmemb'' is incremented.
38 !!RETURN VALUE
39
40
41 __lfind()__ returns a pointer to a matching member of the
42 array, or __NULL__ if no match is found. __lsearch()__
43 returns a pointer to a matching member of the array, or to
44 the newly added member if no match is found.
45 !!SEE ALSO
46
47
48 bsearch(3), hsearch(3),
49 tsearch(3)
50 ----
This page is a man page (or other imported legacy content). We are unable to automatically determine the license status of this page.