#include<stdio.h> #include<string.h> const char *my_strchr(char const *str,int ch) { int i=0; for(;str[i]!='\0';i++) { if(str[i]==ch) { return str+i; } } return NULL; } int main() { char ch='c'; char src[]="abcdecf"; char const *ret; ret=my_strchr(src,ch); printf("%s\n",ret); return 0; }
原文地址:http://blog.csdn.net/u013265552/article/details/44994089