-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_strstr.c
More file actions
29 lines (26 loc) · 1.13 KB
/
ft_strstr.c
File metadata and controls
29 lines (26 loc) · 1.13 KB
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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strstr.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: lscariot <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2015/11/23 12:15:11 by lscariot #+# #+# */
/* Updated: 2015/11/27 03:20:01 by lscariot ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
char *ft_strstr(char *str, char *c)
{
size_t len;
if (*c == '\0')
return ((char *)str);
len = ft_strlen(c);
while (*str != '\0')
{
if (*str == *c && ft_memcmp(str, c, len) == 0)
return ((char *)str);
str++;
}
return (NULL);
}