rindex函数和strrchr函数的不同

index系列函数和strchr系列函数
都是用来
找字符串中出的指定一个字符
的声明也几乎一

        #include <strings.h>

        char *index(const char *s, int c);

        char *rindex(const char *s, int c);

        #include <string.h>

        char *strchr(const char *s, int c);

        char *strrchr(const char *s, int c);

主要的不同在indexrindex函数的明中:
        The terminating NULL character is considered to be a part of the strings.

也就是
index系列函数把字符串中最后的束字符也当是字符串的内容理也就是你可以这样
index(str,'\0')
rindex(str,'\0')strchr系列函数就不可以了

你可能感兴趣的:(C++,c,C#)