-
Notifications
You must be signed in to change notification settings - Fork 2
/
ft_strrchr.c
27 lines (25 loc) · 1.05 KB
/
ft_strrchr.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strrchr.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: hbaddrul <hbaddrul@student.42kl.edu.my> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/04/29 15:25:59 by hbaddrul #+# #+# */
/* Updated: 2021/11/21 20:38:40 by hbaddrul ### ########.fr */
/* */
/* ************************************************************************** */
char *ft_strrchr(const char *s, int c)
{
char *ret;
ret = 0;
while (*s)
{
if (*s == (unsigned char)c)
ret = (char *)s;
++s;
}
if (!c)
ret = ((char *)s);
return (ret);
}