libft/ft_strrchr.c
Raphaël 7bd66aee5b
Push libft
125/100 corrected the 14/11/23
2023-11-14 13:31:56 +01:00

29 lines
1.1 KiB
C

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strrchr.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: rparodi <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/11/07 16:58:22 by rparodi #+# #+# */
/* Updated: 2023/11/11 18:46:54 by rparodi ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
char *ft_strrchr(const char *s, int c)
{
size_t i;
i = ft_strlen(s);
while (i > 0)
{
if (s[i] == c % 256)
return ((char *)s + i);
i--;
}
if (s[i] == c % 256)
return ((char *)s + i);
return (NULL);
}