feat: add ft_strrchr function

also add ft_strchr content
This commit is contained in:
2025-10-08 10:31:48 +02:00
parent 1fd9f0c776
commit c25260933d
2 changed files with 27 additions and 0 deletions

15
ft_strrchr.c Normal file
View File

@@ -0,0 +1,15 @@
#include "libft.h"
char *ft_strrchr(const char *s, int c)
{
size_t i;
i = ft_strlen(s) - 1;
while (i >= 0)
{
if (s[i] == c)
return ((char *)s + i);
i--;
}
return (NULL);
}