#include <string.h>
char *strrchr(const char *s, int c);
该函数从字符串 s 中查找 c,在 s 中可能会存在多个 c,但是 strrchr() 返回的是最后一个 c 所在的位置。
测试代码:
[C++] 纯文本查看复制代码
#include <stdio.h>
#include <string.h>
int main(void)
{
char *p = "strrchr function returns a pointer to the last occurrence of the character c in the string s.";
char *sp = strrchr (p, 'i');
printf ("%s\n", sp);
return 0;
}