-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_strrchr.c
executable file
·35 lines (31 loc) · 1.17 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
31
32
33
34
35
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strrchr.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: ngouy <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2014/11/03 12:26:08 by ngouy #+# #+# */
/* Updated: 2015/11/04 17:18:50 by ngouy ### ########.fr */
/* */
/* ************************************************************************** */
/*
** The strchr() function locates the last occurrence of c in the string
** pointed by s.
*/
#include "libft.h"
char *ft_strrchr(const char *s, int c)
{
char *ret;
ret = NULL;
while (*s)
{
if (*s == c)
(ret = (char *)s);
s++;
}
if (c == 0)
return ((char *)s);
else
return (ret);
}