#include<stdio.h>
char* mystrchr(const char* str, char c)
{
if (*str == NULL)
{
return NULL;
}
char* s1 = (char*)str;
while (*s1)
{
if (*s1 == c)
{
return s1;
}
s1++;
}
return NULL;
}
int main()
{
char* str = "abcccdef";
char c = 'd';
char* ret = mystrchr(str, c);
printf("%s\n", ret);
system("pause");
return 0;
}
实现strchr
猜你喜欢
转载自blog.csdn.net/lly17792230965/article/details/80097485
今日推荐
周排行