-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_strrchr.c
executable file
·31 lines (28 loc) · 1.15 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strrchr.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cyildiri <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/09/25 13:12:35 by cyildiri #+# #+# */
/* Updated: 2016/09/26 14:38:53 by cyildiri ### ########.fr */
/* */
/* ************************************************************************** */
#include <string.h>
char *ft_strrchr(const char *s, int c)
{
char *ptr;
int index;
ptr = NULL;
index = 0;
while (s[index] != '\0')
{
if (s[index] == (char)c)
ptr = (char *)&s[index];
index++;
}
if (s[index] == (char)c)
ptr = (char *)&s[index];
return (ptr);
}