-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_strchr.c
32 lines (29 loc) · 1.11 KB
/
ft_strchr.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strchr.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: thifranc <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/02/14 12:16:45 by thifranc #+# #+# */
/* Updated: 2016/02/20 16:28:23 by thifranc ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
char *ft_strchr(const char *s1, int c)
{
int i;
char *s2;
i = 0;
s2 = (char*)s1;
while (s2[i])
{
if (s2[i] == (char)c)
return (&s2[i]);
i++;
}
if (s2[i] == (char)c)
return (&s2[i]);
else
return (NULL);
}