first commit
This commit is contained in:
37
ended/C03/ex04/ft_strstr.c
Normal file
37
ended/C03/ex04/ft_strstr.c
Normal file
@ -0,0 +1,37 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_strstr.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: ajoly <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2022/07/25 10:18:22 by ajoly #+# #+# */
|
||||
/* Updated: 2022/07/25 10:18:26 by ajoly ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
#include <stddef.h>
|
||||
|
||||
char *ft_strstr(char *str, char *to_find)
|
||||
{
|
||||
int i;
|
||||
int j;
|
||||
char *l[255];
|
||||
|
||||
i = 0;
|
||||
j = 0;
|
||||
if (str == 0)
|
||||
{
|
||||
return (NULL);
|
||||
}
|
||||
while (str[i] != '\0')
|
||||
{
|
||||
if (str[i] == to_find[j])
|
||||
{
|
||||
str[j] = to_find[j];
|
||||
j++;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
l[i] = '\0';
|
||||
return (*str);
|
||||
}
|
Reference in New Issue
Block a user