-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_strrchr.c
More file actions
33 lines (30 loc) · 1.11 KB
/
ft_strrchr.c
File metadata and controls
33 lines (30 loc) · 1.11 KB
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
29
30
31
32
33
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strrchr.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: ewilliam <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/12/05 21:58:59 by ewilliam #+# #+# */
/* Updated: 2016/12/05 21:59:09 by ewilliam ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
char *ft_strrchr(const char *s, int c)
{
char *last;
last = NULL;
if ((char)c == '\0')
{
while (*s)
s++;
return ((char*)s);
}
while (*s)
{
if (*s == (char)c)
last = (char*)s;
s++;
}
return (last);
}