blob: 4cedb763b9ddecc466cae056e467d66d1d935e48 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strrchr.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/10/07 10:26:24 by cacharle #+# #+# */
/* Updated: 2019/11/21 18:46:27 by cacharle ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
char *ft_strrchr(const char *s, int c)
{
size_t i;
i = ft_strlen(s) + 1;
while (s[--i] != (char)c)
if (i == 0)
return (NULL);
return ((char*)s + i);
}
|