Learning C
C Function References
C Useful Resources
Selected Reading
© 2011 TutorialsPoint.COM
|
C - strrchr function
Synopsis:
#include <stdio.h>
char *strrchr(char *string, int c);
|
Description:
The strrchr function searches string for the last occurrence of c. The null character terminating string is included in the search.
Return Value
The strrchr function returns a pointer to the last occurrence of character c in string or a null pointer if no matching character is found.
Example
#include <stdio.h>
int main() {
char *s;
char buf [] = "This is a testing";
s = strrchr (buf, 't');
if (s != NULL)
printf ("found a 't' at %s\n", s);
return 0;
}
|
It will proiduce following result:
|
|
|
|