42-archive/42-piscine-c/d05/ex05/ft_strstr.c
2016-08-25 20:50:28 +02:00

31 lines
1.1 KiB
C

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strstr.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/08/07 10:48:35 by jhalford #+# #+# */
/* Updated: 2016/08/09 13:53:17 by jhalford ### ########.fr */
/* */
/* ************************************************************************** */
char *ft_strstr(char *str, char *to_find)
{
int i;
int j;
i = 0;
while (str[i] != '\0')
{
j = 0;
while (str[i + j] == to_find[j])
{
j++;
if (to_find[j] == '\0')
return (str + i);
}
i++;
}
return (0);
}