Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ bsearch(lib) — Sprite KS.390

Media Vault

Software Library

Restoration Projects

Artifacts Sought

bsearch  —  C Library Procedures

NAME

bsearch − Binary search

SYNOPSIS

void ∗bsearch(key, base, n, size, cmp)

ARGUMENTS

void ∗key; Pointer to the object being searched for. 

void ∗base; Pointer to the base of the array to search. 

size_t n; Number of items in the array. 

size_t size; Size of each item. 

int (∗cmp)(); Function to compare two items. 
 

DESCRIPTION

Bsearch searches base[0] ... base[n - 1] for an item that matches ∗key.  The function cmp must return negative if its first argument (the search key) is less than its second (a table entry), zero if equal, and positive if greater.  Items in the array base must be in ascending order.  bsearch returns a pointer to a matching item, or NULL if none exits. 
 

KEYWORDS

search
 

Sprite version 1.0  —  March 21, 1989

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026