-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_strchr.c
35 lines (32 loc) · 1.24 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* strchr.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: vinguyen <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/10/01 00:42:06 by vinguyen #+# #+# */
/* Updated: 2019/10/01 00:42:07 by vinguyen ### ########.fr */
/* */
/* ************************************************************************** */
/*
** Locates the first occurence of c in a string. The null character \0
** is part of the string
** Input: const char s, int c
** Return:
** ptr to located char
** NULL if not in the string
*/
#include "libft.h"
char *ft_strchr(const char *s, int c)
{
while ((*s != '\0') && (*s != c))
{
s++;
}
if (*s == c)
{
return ((char *)s);
}
return ((char*)NULL);
}