-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_strchr.c
28 lines (27 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
28
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strchr.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: estettle <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/10/11 11:47:53 by estettle #+# #+# */
/* Updated: 2024/10/11 11:47:54 by estettle ### ########.fr */
/* */
/* ************************************************************************** */
/* ft_strchr()
* locates the first occurence of the character c inside of *s, and returns a
* pointer to it.
*/
char *ft_strchr(const char *s, int c)
{
while (*s)
{
if (*s == (char)c)
return ((char *)s);
s++;
}
if (*s == (char)c)
return ((char *)s);
return (0);
}