c语言 strchr和strcchr的区别

Modified on: Mon, 18 Mar 2019 20:45:04 +0800 热度: 1,439 度

头文件 #include <string.h>

#include <stdio.h>
#include <string.h>
int main()
{
    char str[]="I suppose i am very happy.";
    char * first_a = strchr(str,'a');
    char * last_a = strrchr(str,'a');
    printf("original:%s\n",str);
    printf("str1:%s\n",first_a);
    printf("str2:%s\n",last_a);
    return 0;
}

输出:
original:I suppose i am very happy.
str1:am very happy.
str2:appy.
Program ended with exit code: 0

添加新评论