-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_strchr.c
33 lines (31 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
33
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strchr.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: dpetrosy <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/03/19 16:31:16 by dpetrosy #+# #+# */
/* Updated: 2022/03/19 21:30:40 by dpetrosy ### ########.fr */
/* */
/* ************************************************************************** */
char *ft_strchr(const char *s, int c)
{
char ch;
unsigned int i;
ch = (char)c;
i = 0;
while (s[i])
{
if (s[i] == ch)
{
return ((char *)(s + i));
}
++i;
}
if (s[i] == ch)
{
return ((char *)(s + i));
}
return (0);
}