-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_strrchr.c
25 lines (22 loc) · 1.07 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: jode-vri <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/09/06 21:57:57 by jode-vri #+# #+# */
/* Updated: 2020/09/06 21:59:48 by jode-vri ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
char *ft_strrchr(const char *s, int c)
{
int len;
len = ft_strlen(s);
while (len >= 0 && s[len] != c)
len--;
if (s[len] == c)
return ((char *)&s[len]);
return (NULL);
}