-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_strchr.c
39 lines (33 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
36
37
38
39
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strchr.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: evdos-sa <evdos-sa@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/11/02 12:56:41 by evdos-sa #+# #+# */
/* Updated: 2022/11/19 17:02:16 by evdos-sa ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
char *ft_strchr(const char *s, int c)
{
size_t i;
i = 0;
while (s[i] != '\0' && c != s[i])
s++;
if (c == s[i])
return ((char *)&s[i]);
return (NULL);
}
/*
int main ()
{
const char str[] = "E.Mota";
const char ch = '7';
char *ret;
ret = ft_strchr(str, ch);
printf("String after |%c| is - |%s|\n", ch, ret);
return(0);
}
*/