Bsearch - Analog Devices VISUALDSP++ 3.5 Manual

C/c++ compiler and library for adsp-219x processors
Hide thumbs Also See for VISUALDSP++ 3.5:
Table of Contents

Advertisement

bsearch

perform binary search in a sorted array
Synopsis
#include <stdlib.h>
void *bsearch(const void *key, const void *base,
size_t nelem, size_t size,
int (*compare)(const void *, const void *));
Description
The
function executes a binary search operation on a pre-sorted
bsearch
array, where:
is a pointer to the element to search for
key
points to the start of the array
base
is the number of elements in the array
nelem
is the size of each element of the array
size
*compare
takes as parameters a pointer to the
element and should return a value less than, equal to, or greater
than zero, according to whether the first parameter is less than,
equal to, or greater than the second.
The
function returns a pointer to the first occurrence of
bsearch
the array.
Error Conditions
The
function returns a null pointer if the key is not found in the
bsearch
array.
VisualDSP++ 3.5 C/C++ Compiler and Library Manual
for ADSP-219x DSPs
points to the function used to compare two elements. It
C/C++ Run-Time Library
and a pointer to an array
key
in
key
3-39

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the VISUALDSP++ 3.5 and is the answer not in the manual?

Questions and answers

Subscribe to Our Youtube Channel

Related Products for Analog Devices VISUALDSP++ 3.5

Table of Contents