libft/str/ft_strrchr.c
Raphael 2cf0714dc7
docs(str): moving the actual documentation on the header
- The documentation on the header allow u to see on the files where the
header is inclued
2025-09-05 16:30:00 +02:00

30 lines
1.1 KiB
C

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strrchr.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: rparodi <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/11/07 16:58:22 by rparodi #+# #+# */
/* Updated: 2025/09/05 16:17:50 by rparodi ### ########.fr */
/* */
/* ************************************************************************** */
#include "str.h"
#include <unistd.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);
}