2022-09-27 10:29:23 -04:00
|
|
|
/* ************************************************************************** */
|
|
|
|
/* */
|
|
|
|
/* ::: :::::::: */
|
|
|
|
/* ft_strrchr.c :+: :+: :+: */
|
|
|
|
/* +:+ +:+ +:+ */
|
|
|
|
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
|
|
|
|
/* +#+#+#+#+#+ +#+ */
|
|
|
|
/* Created: 2022/09/27 08:25:33 by cchauvet #+# #+# */
|
2022-10-04 16:04:23 -04:00
|
|
|
/* Updated: 2022/10/04 15:03:56 by cchauvet ### ########.fr */
|
2022-09-27 10:29:23 -04:00
|
|
|
/* */
|
|
|
|
/* ************************************************************************** */
|
|
|
|
|
|
|
|
#include "libft.h"
|
|
|
|
|
2022-10-04 08:21:55 -04:00
|
|
|
char *ft_strrchr(const char *s, int c)
|
2022-09-27 10:29:23 -04:00
|
|
|
{
|
2022-10-04 08:21:55 -04:00
|
|
|
size_t i;
|
2022-09-27 10:29:23 -04:00
|
|
|
|
2022-10-04 16:04:23 -04:00
|
|
|
i = ft_strlen(s) + 1;
|
|
|
|
while (i-- > 0)
|
2022-10-04 08:21:55 -04:00
|
|
|
if (s[i] == c)
|
2022-10-04 16:04:23 -04:00
|
|
|
return ((char *) s + i);
|
2022-10-04 08:21:55 -04:00
|
|
|
return (NULL);
|
2022-09-27 10:29:23 -04:00
|
|
|
}
|