-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_strchr.c
More file actions
36 lines (34 loc) · 1.2 KB
/
ft_strchr.c
File metadata and controls
36 lines (34 loc) · 1.2 KB
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
36
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strchr.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: sudaniel <sudaniel@student.42heilbronn.de +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/10/08 17:08:04 by sudaniel #+# #+# */
/* Updated: 2024/10/09 11:09:07 by sudaniel ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
char *ft_strchr(const char *s, int c)
{
c = (unsigned char)c;
while (*s)
{
if (*s == c)
return ((char *)s);
s++;
}
if (*s == c)
return ((char *)s);
return (NULL);
}
/*
int main(void)
{
char *str = "Skrill";
printf("%s\n", ft_strchr(str, 'l'));
printf("%s\n", strchr(str, 'l'));
return (0);
}
*/