You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
355 B

char *strstr(char *str, char *to_find)
{
int i;
int j;
i = 0;
j = 0;
if (!(to_find[j]))
return (str);
while (str[i])
{
if (str[i] == to_find[0])
{
j = 0;
while (str[i + j] && str[i + j] == to_find[j])
j++;
if (to_find[j] == '\0')
return (&str[i]);
}
if (to_find[j] == '\0')
return (&str[i]);
i++;
}
return (0);
}