29 lines
1.1 KiB
C
Executable file
29 lines
1.1 KiB
C
Executable file
/* ************************************************************************** */
|
|
/* */
|
|
/* ::: :::::::: */
|
|
/* ft_strrchr.c :+: :+: :+: */
|
|
/* +:+ +:+ +:+ */
|
|
/* By: thrieg <thrieg@student.42mulhouse.fr> +#+ +:+ +#+ */
|
|
/* +#+#+#+#+#+ +#+ */
|
|
/* Created: 2024/10/14 17:05:03 by thrieg #+# #+# */
|
|
/* Updated: 2025/02/16 19:05:17 by thrieg ### ########.fr */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
|
|
#include "libft.h"
|
|
|
|
char *ft_strrchr(const char *s, int c)
|
|
{
|
|
char *last_occurence;
|
|
|
|
if ((char)c == '\0')
|
|
return ((char *)(s + ft_strlen(s)));
|
|
last_occurence = NULL;
|
|
while (*s)
|
|
{
|
|
if (*s == (char)c)
|
|
last_occurence = (char *)s;
|
|
s++;
|
|
}
|
|
return (last_occurence);
|
|
}
|