-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathft_strrchr.c
More file actions
26 lines (23 loc) · 1.11 KB
/
Copy pathft_strrchr.c
File metadata and controls
26 lines (23 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strrchr.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: wbeets <wbeets@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2015/03/20 11:57:22 by wbeets #+# #+# */
/* Updated: 2015/03/20 11:57:22 by wbeets ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
#include <string.h>
char *ft_strrchr(const char *s, int c)
{
int len;
len = ft_strlen((char *)s);
while (0 != len && s[len] != (char)c)
len--;
if (s[len] == (char)c)
return ((char *)&s[len]);
return (NULL);
}