Jump to content

C Programming/string.h/strchr

From Wikibooks, open books for an open world

Function name strchr() for C and C++

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

Description
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.

Parameters
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.