Manpage of LSEARCH
LSEARCHSection: Linux Programmer's Manual (3)
NAMElfind, lsearch - linear search of an array
#include <search.h>void *lfind(const void *key, const void *base, size_t *nmemb, size_t size, int(*compar)(const void *, const void *));void *lsearch(const void *key, void *base, size_t *nmemb, size_t size, int(*compar)(const void *, const void *));
DESCRIPTIONlfind() and lsearch() perform a linear search for keyin the array basewhich has *nmembelements of sizebytes each. The comparison function referenced by comparis expected to have two arguments which point to the keyobject and to an array member, in that order, and which returns zero if the keyobject matches the array member, and nonzero otherwise.
If lsearch() does not find a matching element, then the keyobject is inserted at the end of the table, and *nmembis incremented. In particular, one should know that a matching element exists, or that more room is available.
RETURN VALUElfind() returns a pointer to a matching member of the array, or NULL if no match is found. lsearch() returns a pointer to a matching member of the array, or to the newly added member if no match is found.
ATTRIBUTESFor an explanation of the terms used in this section, see attributes(7).
|lfind(), lsearch()||Thread safety||MT-Safe|
CONFORMING TOPOSIX.1-2001, POSIX.1-2008, SVr4, 4.3BSD. Present in libc since libc-4.6.27.
BUGSThe naming is unfortunate.
SEE ALSObsearch(3), hsearch(3), tsearch(3)
This document was created by man2html, using the manual pages.
Time: 16:30:20 GMT, October 09, 2016 Click Here!