ft_strrchr.c 1.0 KB

123456789101112131415161718192021222324
  1. /* ************************************************************************** */
  2. /* */
  3. /* ::: :::::::: */
  4. /* ft_strrchr.c :+: :+: :+: */
  5. /* +:+ +:+ +:+ */
  6. /* By: mazimi <mazimi@student.42.fr> +#+ +:+ +#+ */
  7. /* +#+#+#+#+#+ +#+ */
  8. /* Created: 2014/11/22 15:42:16 by mazimi #+# #+# */
  9. /* Updated: 2015/04/16 19:01:12 by mazimi ### ########.fr */
  10. /* */
  11. /* ************************************************************************** */
  12. #include "../libft.h"
  13. char *ft_strrchr(const char *s, int c)
  14. {
  15. int i;
  16. i = ft_strlen(s) + 1;
  17. while (--i >= -1)
  18. if (s[i] == c)
  19. return ((char *)&s[i]);
  20. return (NULL);
  21. }