-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_strrchr.c
executable file
·26 lines (23 loc) · 1.05 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: jpinyot <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/11/11 22:22:27 by jpinyot #+# #+# */
/* Updated: 2017/11/16 00:13:54 by jpinyot ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
char *ft_strrchr(const char *str, int c)
{
char *s;
s = (char *)&str[ft_strlen(str) + 1];
while (s-- != str)
{
if (*s == c)
return (s);
}
return (NULL);
}