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

(ANSI Standard)

Usage:

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

Where:

const char *s;
points to the string that is to be scanned for the presence of the character.
int c;
is the character to look for.
char *ptr;
points to the first occurrence of the character in the string. If the character does not appear in the string, the NULL pointer is returned.

Description:

"strchr" returns a pointer to the first occurrence of the character "c" in the string "s".

The '\0' that terminates the string is considered part of the string; thus it is possible to find the end of the string with a call like

ptr = strchr( s, '\0' );

See Also:

expl c lib strrchr

Copyright © 1996, Thinkage Ltd.