-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_strrchr.c
executable file
·25 lines (23 loc) · 1.06 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strrchr.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: aemebiku <aemebiku@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2014/06/26 15:44:06 by aemebiku #+# #+# */
/* Updated: 2014/06/26 15:44:07 by aemebiku ### ########.fr */
/* */
/* ************************************************************************** */
char *ft_strrchr(const char *s, int c)
{
int i;
i = 0;
while (s[i] != '\0')
i++;
while (s[i] != (char)c && i >= 0)
i--;
if (s[i] != (char)c)
return (0);
return ((char *)s + i);
}