init
This commit is contained in:
31
C/c03v1/ex04/ft_strstr.c
Normal file
31
C/c03v1/ex04/ft_strstr.c
Normal file
@ -0,0 +1,31 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_strstr.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2022/07/18 19:04:42 by cchauvet #+# #+# */
|
||||
/* Updated: 2022/07/21 13:01:47 by cchauvet ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
char *ft_strstr(char *str, char *tofind)
|
||||
{
|
||||
int i;
|
||||
int j;
|
||||
|
||||
i = 0;
|
||||
while (str[i] != 0)
|
||||
{
|
||||
j = 0;
|
||||
while (str[i + j] == tofind[j])
|
||||
{
|
||||
if (tofind[j] == 0)
|
||||
return (&str[i]);
|
||||
j++;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
return (0);
|
||||
}
|
Reference in New Issue
Block a user