-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_strrchr.c
26 lines (23 loc) · 1.06 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: myoshie <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/04/08 04:16:17 by myoshie #+# #+# */
/* Updated: 2022/05/17 02:35:58 by myoshie ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
char *ft_strrchr(const char *s, int c)
{
size_t i;
i = ft_strlen(s) + 1;
while (i--)
{
if (*(char *)(s + i) == (char)c)
return ((char *)(s + i));
}
return (NULL);
}