29 lines
1.1 KiB
C
29 lines
1.1 KiB
C
|
/* ************************************************************************** */
|
||
|
/* */
|
||
|
/* ::: :::::::: */
|
||
|
/* ft_strrchr.c :+: :+: :+: */
|
||
|
/* +:+ +:+ +:+ */
|
||
|
/* By: gbrochar <marvin@42.fr> +#+ +:+ +#+ */
|
||
|
/* +#+#+#+#+#+ +#+ */
|
||
|
/* Created: 2015/11/27 10:05:56 by gbrochar #+# #+# */
|
||
|
/* Updated: 2015/11/27 10:24:37 by gbrochar ### ########.fr */
|
||
|
/* */
|
||
|
/* ************************************************************************** */
|
||
|
|
||
|
#include "libft.h"
|
||
|
|
||
|
char *ft_strrchr(const char *s, int c)
|
||
|
{
|
||
|
int i;
|
||
|
|
||
|
i = ft_strlen(s);
|
||
|
if (c)
|
||
|
{
|
||
|
while (i--)
|
||
|
if (s[i] == (char)c)
|
||
|
return ((char *)&s[i]);
|
||
|
return (NULL);
|
||
|
}
|
||
|
return ((char *)&s[i]);
|
||
|
}
|