SW006013 Microchip Technology, SW006013 Datasheet - Page 119

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
© 2008 Microchip Technology Inc.
memchr (Continued)
memcmp
Description:
Include:
Prototype:
Arguments:
Return Value:
Remarks:
Example:
if (ptr != NULL)
}
Output:
buf1 : What time is it?
i found at position 7
y not found
Compare the contents of two buffers.
<string.h>
int memcmp(const void *s1, const void *s2, size_t n);
s1
s2
n
Returns a positive number if s1 is greater than s2, zero if s1 is equal to
s2, or a negative number if s1 is less than s2.
This function compares the first n characters in s1 to the first n charac-
ters in s2 and returns a value indicating whether the buffers are less
than, equal to or greater than each other.
#include <string.h> /* memcmp
#include <stdio.h>
int main(void)
{
printf("\n");
ptr = memchr(buf1, ch2, 50);
{
}
else
char buf1[50] = "Where is the time?";
char buf2[50] = "Where did they go?";
char buf3[50] = "Why?";
int res;
printf("buf1 : %s\n", buf1);
printf("buf2 : %s\n", buf2);
printf("buf3 : %s\n\n", buf3);
res = memcmp(buf1, buf2, 6);
if (res < 0)
else if (res == 0)
else
res = ptr - buf1 + 1;
printf("%c found at position %d\n", ch2, res);
printf("%c not found\n", ch2);
printf("buf1 comes before buf2\n");
printf("6 characters of buf1 and buf2 "
printf("buf2 comes before buf1\n");
"are equal\n");
first buffer
second buffer
number of characters to compare
/* for printf */
*/
DS51456E-page 115

Related parts for SW006013