函数原型 char *strchr(const char* _Str,int _Val)函数
头文件 #include <string.h>spa
功能 返回首次出现c的位置的指针,返回的地址是字符串在内存中随机分配的地址再加上你所搜索的字符在字符串位置,若是s中不存在c则返回NULL。指针
函数实现code
char * strchr(const char * _Str, int _Val) { const char * p = _Str; //若是*p==_Val或者*p为'\0',退出循环 while(*p!=_Val && *p) p++; return (char *)p; }