Unix/Linux Go Back    

NetBSD 6.1.5 - man page for lsearch (netbsd section 3)

Linux & Unix Commands - Search Man Pages
Man Page or Keyword Search:   man
Select Man Page Set:       apropos Keyword Search (sections above)

LSEARCH(3)			   BSD Library Functions Manual 		       LSEARCH(3)

     lsearch, lfind -- linear searching routines

     Standard C Library (libc, -lc)

     #include <search.h>

     void *
     lsearch(const void *key, void *base, size_t *nelp, size_t width,
	 int (*compar)(const void *, const void *));

     void *
     lfind(const void *key, const void *base, size_t *nelp, size_t width,
	 int (*compar)(const void *, const void *));

     The functions lsearch(), and lfind() provide basic linear searching functionality.

     base is the pointer to the beginning of an array.	The argument nelp is the current number
     of elements in the array, where each element is width bytes long.	The compar argument
     points to a function which compares its two arguments and returns zero if they are matching,
     and non-zero otherwise.

     The lsearch() and lfind() functions return a pointer into the array referenced by base where
     key is located.  If key does not exist, lfind() will return a null pointer and lsearch()
     will add it to the array.	When an element is added to the array by lsearch() the location
     referenced by the argument nelp is incremented by one.

     bsearch(3), db(3)

     The lsearch() and lfind() functions conform to IEEE Std 1003.1-2001 (``POSIX.1'').

BSD					   July 6, 2005 				      BSD
Unix & Linux Commands & Man Pages : ©2000 - 2018 Unix and Linux Forums

All times are GMT -4. The time now is 06:11 PM.