locate character in string

You're viewing an older version of this page (#3279). View the current version.

View versions (3)

NAME

<span class="Nm" id="strchr">strchr</span>, <span class="Nm" id="strrchr">strrchr</span>

INTERFACE

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

DESCRIPTION

The strchr function locates the first occurrence of &#92;c c (converted to a <span class="Vt">char</span>) in the string pointed to by &#92;c s. The terminating null character is considered part of the string; therefore if &#92;c c is '<span class="Qlq">\\0</span>', the functions locate the terminating '<span class="Qlq">\\0</span>'. &#92;n &#92;n The strrchr function is identical to strchr except it locates the last occurrence of &#92;c c.

RETURN VALUES

The functions strchr and strrchr return a pointer to the located character, or <span class="Dv">NULL</span> if the character does not appear in the string.

SEE ALSO

memchr (3) , strcspn (3) , strpbrk (3) , reference:strsep (3) , strspn (3) , strstr (3) , strtok (3)

STANDARDS

The functions strchr and strrchr conform to