-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_strchr.c
25 lines (22 loc) · 1.06 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strchr.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: mgavillo <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2018/11/08 14:55:13 by mgavillo #+# #+# */
/* Updated: 2018/11/26 16:37:06 by mgavillo ### ########.fr */
/* */
/* ************************************************************************** */
#include <string.h>
char *ft_strchr(const char *s, int c)
{
int i;
i = 0;
while (s[i] != '\0' && s[i] != (char)c)
i++;
if (s[i] == (char)c)
return ((char *)&s[i]);
return (NULL);
}