-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathft_strchr.c
27 lines (24 loc) · 1.14 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
/* ************************************************************************** */
/* */
/* :::::::: */
/* ft_strchr.c :+: :+: */
/* +:+ */
/* By: ksmorozo <[email protected]> +#+ */
/* +#+ */
/* Created: 2020/10/30 11:18:47 by ksmorozo #+# #+# */
/* Updated: 2021/07/07 12:18:27 by ksmorozo ######## odam.nl */
/* */
/* ************************************************************************** */
#include <stddef.h>
char *ft_strchr(const char *str, int ch)
{
unsigned char *modifiable_str;
modifiable_str = (unsigned char *)str;
while (*modifiable_str != ch)
{
if (*modifiable_str == '\0')
return (NULL);
modifiable_str++;
}
return ((char *)modifiable_str);
}