/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_strrchr.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: hulamy +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2019/11/19 19:35:39 by hulamy #+# #+# */ /* Updated: 2019/11/19 19:35:45 by hulamy ### ########.fr */ /* */ /* ************************************************************************** */ /* ** locate the last occurence of character c in string s ** and return pointer to its location */ #include "libft.h" char *ft_strrchr(const char *s, int c) { int i; i = 0; while (s[i]) i++; i++; while (i--) if (s[i] == c) return ((char *)s + i); return (NULL); }