C Language and Libraries Help (clang.hlp) (Table of Contents; Topic list)
_lfind, _lsearch
 Summary Example                         Up Contents Index Back
─────Run-Time Library───────────────────────────────────────────────────────
 
     The _lsearch and _lfind functions perform a linear search for the
     value <key> in an array of <num> elements, each <width> bytes in
     size. (Unlike bsearch, _lsearch and _lfind do not require the
     array to be sorted.) The <base> argument is a pointer to the base
     of the array to be searched.
 
     If <key> is not found, _lsearch adds it to the end of the array,
     and _lfind returns NULL.
 
     The <compare> argument is a pointer to a user-supplied routine
     that compares the key with an array element and returns a value
     specifying their relationship. Both _lsearch and _lfind call the
     <compare> routine one or more times during the search, passing
     pointers to the key and an array element on each call. The
     routine must compare the two, then return one of the following
     values:
 
     Value       Meaning
 
     Nonzero     <key> and <elem> are different
     0           <key> is identical to <elem>
 
     Return Value
 
     If the key is found, both _lsearch and _lfind return a pointer to
     the array element <base> that matches <key>. If the key is not
     found, _lfind returns NULL and _lsearch returns a pointer to a
     newly added item at the end of the array.
                                    -♦-