-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_strrchr.c
executable file
·30 lines (27 loc) · 1.16 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
29
30
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strrchr.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: akharrou <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/02/18 17:08:43 by akharrou #+# #+# */
/* Updated: 2019/03/04 13:17:20 by akharrou ### ########.fr */
/* */
/* ************************************************************************** */
#include "../Includes/stdlib_42.h"
char *ft_strrchr(const char *s, int c)
{
char *last_occurence;
last_occurence = NULL;
while (*s)
{
if (*s == (unsigned char)c)
last_occurence = (char *)s;
s++;
}
if (*s == (unsigned char)c)
return ((char *)s);
else
return (last_occurence);
}