-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_strrchr.c
25 lines (22 loc) · 1.09 KB
/
ft_strrchr.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strrchr.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: xle-baux <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/11/25 15:35:23 by xle-baux #+# #+# */
/* Updated: 2021/12/02 15:17:26 by xle-baux ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
char *ft_strrchr(const char *str, int c)
{
int i;
i = ft_strlen(str);
while (str[i] != (unsigned char)c && i != 0)
i--;
if (str[i] == (unsigned char)c)
return ((char *)&str[i]);
return (NULL);
}