32 lines
1.1 KiB
C
32 lines
1.1 KiB
C
/* ************************************************************************** */
|
|
/* */
|
|
/* ::: :::::::: */
|
|
/* ft_strrchr.c :+: :+: :+: */
|
|
/* +:+ +:+ +:+ */
|
|
/* By: scebula <scebula@student.42.fr> +#+ +:+ +#+ */
|
|
/* +#+#+#+#+#+ +#+ */
|
|
/* Created: 2015/11/26 09:26:10 by scebula #+# #+# */
|
|
/* Updated: 2015/11/27 20:25:48 by scebula ### ########.fr */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
|
|
#include "libft.h"
|
|
|
|
char *ft_strrchr(const char *s, int c)
|
|
{
|
|
char *last;
|
|
|
|
last = NULL;
|
|
while (*s)
|
|
{
|
|
if (*s == (char)c)
|
|
{
|
|
last = (char*)s;
|
|
}
|
|
s++;
|
|
}
|
|
if (*s == (char)c)
|
|
return ((char *)s);
|
|
return (last);
|
|
}
|