/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_strrchr.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: bchanot +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2015/11/25 13:54:03 by bchanot #+# #+# */ /* Updated: 2018/10/13 22:50:35 by bchanot ### ########.fr */ /* */ /* ************************************************************************** */ #include "libft.h" char *ft_strrchr(const char *s, int c) { size_t len; if (!s || !c) return (NULL); len = ft_strlen(s); while (len && s[len] != (char)c) len--; if (s[len] == (char)c) return ((char *)&s[len]); return (NULL); }