#include <stdio.h>
#include <string.h>
int main(int argc, char const *argv[])
{
char data[521]="I live you lfl";
char*find= strrchr(data,'y');
printf("find=%c\n",*find);
printf("find=%s\n",find);
return 0;
}
TRCHR(3) Linux Programmer's Manual STRCHR(3)
NAME
strchr, strrchr, strchrnul - locate character in string
SYNOPSIS
#include <string.h>
函数原型
char *strrchr(const char *s, int c);
功能
从字符串末尾开始查找指定字符第一次出现的位置;
参数
const char *s :被查的字符串;
int c :要查找的字符;
返回值
成功:返回查找到的字符的地址;
失败:返回NULL;