COHERENT manpages

This page displays the COHERENT manpage for strchr() [Find a character in a string].

List of available manpages
Index


strchr() -- String Function (libc)

Find a character in a string
#include <string.h>
char *strchr(string, character)
char *string; int character;

strchr() searches for the  first occurrence of character within string. The
null character at  the end of string is included  within the search.  It is
equivalent to the COHERENT function index().

strchr()  returns a  pointer to  the first  occurrence of  character within
string. If character is not found, it returns NULL.

Having strchr()  search for a null character will  always produce a pointer
to the end of a string.  For example,

    char *string;
    assert(strchr(string, '\0') == string + strlen(string));

never fails.

See Also

libc,
string.h
ANSI Standard, §7.11.5.2
POSIX Standard, §8.1