11.07.2015 Views

PicC 9.50 dsPIC Manual.pdf

PicC 9.50 dsPIC Manual.pdf

PicC 9.50 dsPIC Manual.pdf

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Library FunctionsBSEARCHSynopsis#include void * bsearch (const void * key, void * base, size_t n_memb,size_t size, int (*compar)(const void *, const void *))DescriptionThe bsearch() function searches a sorted array for an element matching a particular key. It uses abinary search algorithm, calling the function pointed to by compar to compare elements in the array.Example128#include #include #include struct value {char name[40];int value;} values[100];intval_cmp (const void * p1, const void * p2){return strcmp(((const struct value *)p1)->name,((const struct value *)p2)->name);}voidmain (void){char inbuf[80];int i;struct value * vp;

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!