ft_nm/subprojects/libft/ft_strrchr.c
2019-05-10 18:29:21 +03:00

27 lines
1.1 KiB
C

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strrchar.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: gtertysh <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/11/30 18:32:21 by gtertysh #+# #+# */
/* Updated: 2016/12/02 16:19:20 by gtertysh ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
char *ft_strrchr(const char *s, int c)
{
const char *str;
str = s;
while (*s)
s++;
while (s != str && *s != (char)c)
s--;
if (*s == (char)c)
return ((char *)s);
return (NULL);
}