char *ft_strstr(char *str, char *to_find)
{
int i;
int j;
if (to_find[0] == '\0')
return (str);
i = 0;
while (str[i])
{
j = 0;
while ((str[i + j] == to_find[j]) && str[i + j])
{
j++;
if (to_find[j] == '\0')
return (&str[i]);
}
i++;
}
return (0);
}
#include <stdio.h>
int main(void)
{
char s1[] = "Rugby Top 14 ?";
char s2[] = "Rugby";
char s3[] = "Rug";
printf("%s\n", ft_strstr(s1, s3));
}
To embed this project on your website, copy the following code and paste it into your website's HTML: