index系列函数和strchr系列函数的区别

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);

区别:index系列函数把字符串中最后的结束字符也当是字符串的内容处理,可以index(str,'\0')和rindex(str,'\0'),而strchr系列函数就不可以