MEMCHR - find first occurrence of a character in a string.

(ANSI Standard)

Usage:

#include <string.h>
ptr = memchr( s, c, N );

Where:

const void *s;
points to the string to be scanned.
int c;
is the character to look for.
size_t N;
is the number of characters to look at before giving up.
void *ptr;
points to the first occurrence of the character in the string. If the character is not found, the NULL pointer is returned.

Description:

"memchr" returns a pointer to the first occurrence of the character "c" in the first N characters of the string "s".

Unlike "strchr", "memchr" ignores any '\0' bytes it comes across; thus it does not stop if it finds the end of the string, but keeps on going until it has looked at N characters.

See Also:

expl c lib strchr

expl c lib memrchr

Copyright © 1996, Thinkage Ltd.