-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_strrchr.c
26 lines (23 loc) · 1.12 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
26
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strrchr.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: lenzo-pe <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/02/10 10:10:50 by lenzo-pe #+# #+# */
/* Updated: 2021/04/25 20:22:33 by lenzo-pe ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_string.h"
char *ft_strrchr(const char *str, int c)
{
size_t len;
len = ft_strlen(str);
if ((char)c == '\0')
return ((char *)str + len);
while (len--)
if (*(str + len) == (char)c)
return ((char *)(str + len));
return (NULL);
}