strchr()
查找字符串s中首次出现字符c的位置
char * my_strchr(char *str1, char str2){while (*str1 != str2 && *str1 != NULL){str1++;}return str1;}int main(){char string[17];char *ptr, c = 'r';strcpy(string, "Thisisastring");ptr = my_strchr(string, c);if (ptr)printf("The character %cis at position:%s\n", c, ptr);elseprintf("The character was not found\n");system("pause");return 0;}