Memchr, Memcmp, Memchr memcmp – Zilog ZUSBOPTS User Manual
Page 455: Synopsis, Returns, Example

UM017105-0511
Standard Functions
Zilog Developer Studio II – ZNEO™
User Manual
427
memchr
Locates the first occurrence of c (converted to an
unsigned char
) in the initial n charac-
ters of the object pointed to by s.
Synopsis
#include
void *memchr(const void *s, int c, size_t n);
Returns
A pointer to the located character or a null pointer if the character does not occur in the
object.
Example
char *p1;
char str[]="COMPASS";
c='p';
p1=memchr(str,c,sizeof(char));
memcmp
Compares the first n characters of the object pointed to by s2 to the object pointed to by s1.
Synopsis
#include
int memcmp(const void *s1, const void *s2, size_t n);
Returns
An integer greater than, equal to, or less than zero, according as the object pointed to by s1
is greater than, equal to, or less than the object pointed to by s2.
Example
char s1[]="COMPASS";
char s2[]="IDE";
int res;
res=memcmp(s1, s2, sizeof (char));