-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_strstr.c
34 lines (31 loc) · 1.25 KB
/
ft_strstr.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/* ************************************************************************** */
/* LE - / */
/* / */
/* ft_strstr.c .:: .:/ . .:: */
/* +:+:+ +: +: +:+:+ */
/* By: rcabotia <marvin@le-101.fr> +:+ +: +: +:+ */
/* #+# #+ #+ #+# */
/* Created: 2018/07/09 10:15:33 by rcabotia #+# ## ## #+# */
/* Updated: 2018/10/05 19:00:31 by rcabotia ### #+. /#+ ###.fr */
/* / */
/* / */
/* ************************************************************************** */
#include "libft.h"
char *ft_strstr(const char *big, const char *little)
{
int i;
int j;
j = 0;
if (little[0] == '\0')
return ((char *)big);
while (big[j])
{
i = 0;
while (big[i + j] == little[i] && little[i])
i++;
if (!little[i])
return ((char *)big + j);
j++;
}
return (0);
}