bsearch.3 (73088) | bsearch.3 (79754) |
---|---|
1.\" Copyright (c) 1990, 1991, 1993, 1994 2.\" The Regents of the University of California. All rights reserved. 3.\" 4.\" This code is derived from software contributed to Berkeley by 5.\" the American National Standards Committee X3, on Information 6.\" Processing Systems. 7.\" 8.\" Redistribution and use in source and binary forms, with or without --- 20 unchanged lines hidden (view full) --- 29.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 30.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 31.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 32.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 33.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 34.\" SUCH DAMAGE. 35.\" 36.\" @(#)bsearch.3 8.3 (Berkeley) 4/19/94 | 1.\" Copyright (c) 1990, 1991, 1993, 1994 2.\" The Regents of the University of California. All rights reserved. 3.\" 4.\" This code is derived from software contributed to Berkeley by 5.\" the American National Standards Committee X3, on Information 6.\" Processing Systems. 7.\" 8.\" Redistribution and use in source and binary forms, with or without --- 20 unchanged lines hidden (view full) --- 29.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 30.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 31.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 32.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 33.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 34.\" SUCH DAMAGE. 35.\" 36.\" @(#)bsearch.3 8.3 (Berkeley) 4/19/94 |
37.\" $FreeBSD: head/lib/libc/stdlib/bsearch.3 73088 2001-02-26 13:23:47Z ru $ | 37.\" $FreeBSD: head/lib/libc/stdlib/bsearch.3 79754 2001-07-15 07:53:42Z dd $ |
38.\" 39.Dd April 19, 1994 40.Dt BSEARCH 3 41.Os 42.Sh NAME 43.Nm bsearch 44.Nd binary search of a sorted table 45.Sh LIBRARY 46.Lb libc 47.Sh SYNOPSIS 48.Fd #include <stdlib.h> 49.Ft void * 50.Fn bsearch "const void *key" "const void *base" "size_t nmemb" "size_t size" "int (*compar) (const void *, const void *)" 51.Sh DESCRIPTION 52The 53.Fn bsearch 54function searches an array of 55.Fa nmemb | 38.\" 39.Dd April 19, 1994 40.Dt BSEARCH 3 41.Os 42.Sh NAME 43.Nm bsearch 44.Nd binary search of a sorted table 45.Sh LIBRARY 46.Lb libc 47.Sh SYNOPSIS 48.Fd #include <stdlib.h> 49.Ft void * 50.Fn bsearch "const void *key" "const void *base" "size_t nmemb" "size_t size" "int (*compar) (const void *, const void *)" 51.Sh DESCRIPTION 52The 53.Fn bsearch 54function searches an array of 55.Fa nmemb |
56objects, the initial member of which is | 56objects, the initial member of which is |
57pointed to by 58.Fa base , 59for a member that matches the object pointed to by 60.Fa key . | 57pointed to by 58.Fa base , 59for a member that matches the object pointed to by 60.Fa key . |
61The size of each member of the array is specified by | 61The size of each member of the array is specified by |
62.Fa size . 63.Pp 64The contents of the array should be in ascending sorted order according 65to the comparison function referenced by 66.Fa compar . 67The 68.Fa compar 69routine --- 24 unchanged lines hidden --- | 62.Fa size . 63.Pp 64The contents of the array should be in ascending sorted order according 65to the comparison function referenced by 66.Fa compar . 67The 68.Fa compar 69routine --- 24 unchanged lines hidden --- |