C memchr()

The memchr() function searches the array pointed to by buffer for the first occurrence of ch in the first count characters.

The memchr() function returns a pointer to the first occurrence of ch in buffer, or it returns a null pointer if ch is not found.

memchr() Syntax

Following is the syntax of the memchr() function :

void *memchr(const void *buffer, int ch, size_t count);

memchr() Example

Following program prints is a test on the screen :

void main()
	char *p;
	p = memchr("this is a test", ' ', 14);

C Online Test

« Previous Chapter Next Function »

Like/Share Us on Facebook 😋