SW006013 Microchip Technology, SW006013 Datasheet - Page 100

MPLAB C Compiler For DsPIC DSCs

SW006013

Manufacturer Part Number
SW006013
Description
MPLAB C Compiler For DsPIC DSCs
Manufacturer
Microchip Technology
Series
DsPIC30F/33Fr
Type
MPLAB® C Compilerr
Datasheet

Specifications of SW006013

Supported Families
DsPIC30F, DsPIC33F
Core Architecture
DsPIC
Kit Contents
Software And Docs
Mcu Supported Families
DsPIC30F And DsPIC33F
Tool Function
Compiler
Tool Type
Compiler
Processor Series
dsPIC
Lead Free Status / RoHS Status
na
For Use With/related Products
dSPIC DSCs
Lead Free Status / Rohs Status
Lead free / RoHS Compliant
DS51456E-page 96
atol (Continued)
Example:
bsearch
Description:
Include:
Prototype:
Arguments:
Return Value:
Remarks:
#include <stdio.h>
#include <stdlib.h> /* for atol
int main(void)
{
}
Output:
String = " -123456"
String = "2Number"
Performs a binary search
<stdlib.h>
void *bsearch(const void *key, const void *base,
key
base
nelem
size
cmp
ck
ce
Returns a pointer to the object being searched for if found; otherwise,
returns NULL.
The value returned by the compare function is <0 if ck is less than ce,
0 if ck is equal to ce, or >0 if ck is greater than ce.
In the following example, qsort is used to sort the list before bsearch
is called. bsearch requires the list to be sorted according to the com-
parison function. This comp uses ascending order.
size_t nelem, size_t size,
int (*cmp)(const void *ck, const void *ce));
char a[] = " -123456";
char b[] = "2Number";
long x;
x = atol(a);
printf("String = \"%s\"
x = atol(b);
printf("String = \"%s\"
object to search for
pointer to the start of the search data
number of elements
size of elements
pointer to the comparison function
pointer to the key for the search
pointer to the element being compared with the key.
/* for printf */
int = -123456
int = 2
int = %ld\n", a, x);
int = %ld\n", b, x);
© 2008 Microchip Technology Inc.
*/

Related parts for SW006013