-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_strchr.c
More file actions
40 lines (34 loc) · 1.23 KB
/
ft_strchr.c
File metadata and controls
40 lines (34 loc) · 1.23 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
39
40
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strchr.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: moabed <moabed@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/08/06 19:37:26 by moabed #+# #+# */
/* Updated: 2025/08/17 17:14:04 by moabed ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
char *ft_strchr(const char *s, int c)
{
char x;
x = (char)c;
while (*s)
{
if (*s == x)
return ((char *)s);
s++;
}
if (x == '\0')
return ((char *)s);
return (NULL);
}
// #include <stdio.h>
// int main(void)
// {
// char *p;
// char x[] ="ahmad";
// p = ft_strchr(x,'m');
// printf("%c %c %c",p[0], p[1],ft_strlen(x));
// }