-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_strstr.c
executable file
·35 lines (32 loc) · 1.24 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
35
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strstr.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cyildiri <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/09/25 13:44:46 by cyildiri #+# #+# */
/* Updated: 2016/09/28 13:22:21 by cyildiri ### ########.fr */
/* */
/* ************************************************************************** */
#include <string.h>
#include "libft.h"
char *ft_strstr(const char *big, const char *little)
{
char *ptr;
int index;
index = 0;
if (*little == '\0')
return ((char *)big);
while (big[index] != '\0')
{
if (big[index] == little[0])
{
ptr = (char *)&big[index];
if (!ft_memcmp(ptr, little, ft_strlen(little)))
return (ptr);
}
index++;
}
return (NULL);
}