Add all git folders
This commit is contained in:
31
C_Piscine_C_03/git/ex04/ft_strstr.c
Normal file
31
C_Piscine_C_03/git/ex04/ft_strstr.c
Normal file
@@ -0,0 +1,31 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_strstr.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: gbaconni <marvin@42lausanne.ch> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2021/08/12 16:49:31 by gbaconni #+# #+# */
|
||||
/* Updated: 2021/08/12 17:11:14 by gbaconni ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
char *ft_strstr(char *str, char *to_find)
|
||||
{
|
||||
unsigned int i;
|
||||
unsigned int j;
|
||||
|
||||
i = 0;
|
||||
while (str[i] != '\0')
|
||||
{
|
||||
j = 0;
|
||||
while (str[i + j] != '\0' && str[i + j] == to_find[j])
|
||||
j++;
|
||||
if (to_find[j] == '\0')
|
||||
return (str + i);
|
||||
i++;
|
||||
}
|
||||
return (NULL);
|
||||
}
|
||||
Reference in New Issue
Block a user