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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Library FunctionsMEMCMPSynopsis#include int memcmp (const void * s1, const void * s2, size_t n)DescriptionThe memcmp() function compares two blocks of memory, of length n, and returns a signed valuesimilar to strncmp(). Unlike strncmp() the comparison does not stop on a null character. The ASCIIcollating sequence is used for the comparison, but the effect of including non-ASCII characters inthe memory blocks on the sense of the return value is indeterminate. Testing for equality is alwaysreliable.Example#include #include voidmain (void){int buf[10], cow[10], i;buf[0] = 1;buf[2] = 4;cow[0] = 1;cow[2] = 5;buf[1] = 3;cow[1] = 3;i = memcmp(buf, cow, 3*sizeof(int));if(i < 0)printf("less than\n");else if(i > 0)printf("Greater than\n");else167

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

Saved successfully!

Ooh no, something went wrong!