memchr() — Search buffer

Format

#include <string.h>

void *memchr(const void *buf, int c, size_t count);

General description

The memchr() built-in function searches the first count bytes pointed to by buf for the first occurrence of c converted to an unsigned character. The search continues until it finds c or examines count bytes.

Returned value

If successful, memchr() returns a pointer to the location of c in buf.

If c is not within the first count bytes of buf, memchr() returns NULL.

Related Information