-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_strrchr.c
executable file
Β·28 lines (25 loc) Β· 1.13 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
27
28
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strrchr.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: selchoi <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/12/29 15:40:00 by selchoi #+# #+# */
/* Updated: 2021/01/09 17:00:24 by selchoi ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
char *ft_strrchr(const char *s, int c)
{
int s_len;
s_len = ft_strlen((char *)s);
if ((char)c == '\0')
return ((char *)s + s_len);
while (s_len--)
{
if (*(s + s_len) == (char)c)
return ((char *)(s + s_len));
}
return (NULL);
}