Corewar-Final/libft/libft/ft_strrchr.c
Jeremy FLEURY 748d10f4f3 push
2019-07-17 11:22:24 +02:00

29 lines
1.1 KiB
C

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strrchr.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: jfleury <jfleury@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2018/11/08 14:47:08 by jfleury #+# #+# */
/* Updated: 2018/11/13 18:28:35 by jfleury ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
#include <string.h>
char *ft_strrchr(const char *s, int c)
{
int i;
i = ft_strlen((char *)s);
while (i >= 0)
{
if (s[i] == c)
return ((char *)s + i);
i--;
}
return (NULL);
}