-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_strrchr.c
30 lines (27 loc) · 1.13 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
28
29
30
/* ************************************************************************** */
/* LE - / */
/* / */
/* ft_strrchr.c .:: .:/ . .:: */
/* +:+:+ +: +: +:+:+ */
/* By: thperchi <marvin@le-101.fr> +:+ +: +: +:+ */
/* #+# #+ #+ #+# */
/* Created: 2018/07/09 05:04:26 by thperchi #+# ## ## #+# */
/* Updated: 2018/10/12 05:37:00 by thperchi ### #+. /#+ ###.fr */
/* / */
/* / */
/* ************************************************************************** */
#include "libft.h"
char *ft_strrchr(const char *s, int c)
{
int x;
x = ft_strlen(s);
while (x >= 0)
{
if (s[x] == c)
{
return ((char *)s + x);
}
x--;
}
return (NULL);
}