-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_strchr.c
37 lines (34 loc) · 1.15 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
33
34
35
36
37
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strchr.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tlevaufr <tlevaufr@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/11/13 14:53:53 by tlevaufr #+# #+# */
/* Updated: 2017/12/04 18:53:07 by tlevaufr ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
char *ft_strchr(const char *s, int c)
{
int i;
i = 0;
if (c == 0)
{
while (s[i])
i++;
return ((char *)&s[i]);
}
if (c > 0)
{
while (s[i] && s[i] != c)
i++;
if (s[i])
return ((char *)&s[i]);
else
return (NULL);
}
else
return (NULL);
}