You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

31 lines
1.1 KiB

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strrchr.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: emartine <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/11/07 19:58:19 by emartine #+# #+# */
/* Updated: 2017/11/07 19:58:20 by emartine ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
char *ft_strrchr(const char *s, int c)
{
size_t i;
i = 0;
while (s[i])
i++;
if (c == 0)
return ((char *)s + i);
while (i > 0)
{
i--;
if (s[i] == c)
return ((char *)s + i);
}
return (NULL);
}