strrchr()

Bob Stout Bob.Stout at p6.f506.n106.z1.fidonet.org
Tue Dec 26 05:46:32 AEST 1989


The strrchr() function is the ANSI equivalent of the older rindex() function  
(sort of - implementations differ). It returns a pointer to the last char in  
an array matching the char specified. Its equivalent function for matching  
the first char is strchr(). Example:

        char *test = "abcdefgfedcba";

        puts(strchr(test, 'd'));        /* prints "defgfedcba"  */
        puts(strrchr(test, 'd'));       /* prints "dcba"        */
 



More information about the Comp.lang.c mailing list