

strchr()                 String Function                 strchr()




Find a character in a string

#include <string.h>

cchhaarr *ssttrrcchhrr(_s_t_r_i_n_g, _c_h_a_r_a_c_t_e_r);
cchhaarr *_s_t_r_i_n_g; iinntt _c_h_a_r_a_c_t_e_r;

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 iinn-
ddeexx.

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

Having ssttrrcchhrr  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 *****

string functions




























COHERENT Lexicon                                           Page 1


