C Programming/string.h/strchr

From Wikibooks, open books for an open world
Jump to navigation Jump to search

Function name strchr() for C and C++

include <string.h>
char *strchr(const char *s, int c);

The strchr() function locates the first occurrence of c, cast to char, in the string pointed to by s. The terminating null character is considered a part of the string.

s Points to the string to be searched.

c Is the character to search for in string s.

Return Values
The strchr() function returns a pointer to the first occurrence of character c located within s. If character c does not occur in the string, strchr() returns a null pointer.