Memchr function, Memcmp function – Zilog Z80380 User Manual
Page 74

Library Functions
Run Time Environment
4–10
UM004001-COR1103
memchr
FUNCTION
Header file statement:
#include
Syntax:
void *memchr
( const void *buf, int c, size_t count )
The memchr function looks for the first occurrence of c in the first count bytes of buf. It
stops when it finds c or when it has checked the first count bytes.
Return Value
If successful, memchr returns a pointer to the first location of c in buf. Otherwise, it returns
NULL.
memcmp
FUNCTION
Header file statement:
#include
Syntax:
int memcmp
(const void *buf1, const void *buf2, size_t count)
The memcmp function compares the first count bytes of buf1 and buf2 and returns a value
indicating their relationship, as follows:
Value
Meaning
< 0
buf1 less than buf2
= 0
buf1 identical to buf2
> 0
buf1 greater than buf2
Return Value
The memcmp function returns an integer value, as described above.
Parameter
Description
buf
Pointer to buffer
c
Character to look for
count
Number of characters
Parameter
Description
buf1
First buffer
buf2
Second buffer
count
Number of characters