const char *my_strstr(const char *str, const char *sub_str)
{
for(int i = 0; str[i] != '\0'; i++)
{
int tem = i; //tem保留主串中的起始判断下标位置
int j = 0;
while(str[tem++] == sub_str[j++])
{
if(sub_str[j] == '\0')
{
return &str[i];
}
}
}
return NULL;
}
{
for(int i = 0; str[i] != '\0'; i++)
{
int tem = i; //tem保留主串中的起始判断下标位置
int j = 0;
while(str[tem++] == sub_str[j++])
{
if(sub_str[j] == '\0')
{
return &str[i];
}
}
}
return NULL;
}
char * Strchr(char to[], char Ch)
{
int i = 0;
while (to[i] != Ch && to[i] != '\0')
{
int i = 0;
while (to[i] != Ch && to[i] != '\0')
i++;
return to[i] != '\0' ? to + i : NULL;
}
return to[i] != '\0' ? to + i : NULL;
}