-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_strchr.c
More file actions
38 lines (34 loc) · 1.28 KB
/
ft_strchr.c
File metadata and controls
38 lines (34 loc) · 1.28 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
37
38
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strchr.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: bhielsch <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/10/05 11:13:22 by bhielsch #+# #+# */
/* Updated: 2022/10/13 17:44:38 by bhielsch ### ########.fr */
/* */
/* ************************************************************************** */
#include <stdio.h>
#include <string.h>
#include "libft.h"
char *ft_strchr(const char *s, int c)
{
char *str;
str = (char *)s;
while (*str)
{
if (*str == (char)c)
return (str);
str++;
}
if ((char)c == '\0')
return (str);
return (NULL);
}
// int main()
// {
// char s[] = "tripouille";
// printf("Mine: %s\n", ft_strchr(s, 't' + 256));
// printf("OG: %s\n", strchr(s, 't' + 256));
// }