-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_strchr.c
31 lines (28 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strchr.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: jinsyang <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/11/15 12:47:32 by jinsyang #+# #+# */
/* Updated: 2022/11/23 16:01:01 by jinsyang ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
char *ft_strchr(const char *s, int c)
{
size_t i;
i = 0;
if (c >= 256)
c %= 256;
while (s[i])
{
if (s[i] == c)
return (((char *)&s[i]));
i++;
}
if (s[i] == c)
return (((char *)&s[i]));
return (NULL);
}