-
Notifications
You must be signed in to change notification settings - Fork 1
/
ft_strchr.c
41 lines (37 loc) · 1.23 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
40
41
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strchr.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: jony <jony@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/10/21 12:39:22 by mhasan #+# #+# */
/* Updated: 2019/11/04 22:07:12 by jony ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
char *ft_strchr(const char *s, int c)
{
while (*s)
{
if (*s == c)
{
return ((char *)s);
}
++s;
}
if (c == '\0')
{
return ((char *)s);
}
return (0);
}
int main()
{
char str[] = "http://www.tutorialspoint.com";
char ch = '.';
char *ret;
ret = ft_strchr(str, ch);
printf("String after |%c| is - |%s|\n", ch, ret);
return (0);
}