bsearch of empty array

Chris Dollin kers at hplb.hpl.hp.com
Thu May 16 00:49:37 AEST 1991


If bsearch is called with $nmemb == 0$, is $base$ required to point to a
legitimate array, or can it be $NULL$ ?

[A library I know of hangs in this case; I'd like to know if my code is broken,
or if the library is.]

A similar question arises for $qsort$; if one $qsort$'s 0 elements, is the
value of the array pointer required to point to a proper array, or is it
allowed to be $NULL$?
--

Kers.       | "A foolish hobgoblin has the consistency of little minds".



More information about the Comp.std.c mailing list