-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_strrchr.c
More file actions
30 lines (27 loc) · 1.11 KB
/
ft_strrchr.c
File metadata and controls
30 lines (27 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strrchr.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: eagoumi <eagoumi@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/10/10 20:08:53 by eagoumi #+# #+# */
/* Updated: 2022/11/08 20:35:39 by eagoumi ### ########.fr */
/* */
/* ************************************************************************** */
#include "./libft.h"
#include <stdio.h>
char *ft_strrchr(const char *ch, int s)
{
size_t i;
i = ft_strlen(ch);
while (i >= 0)
{
if (ch[i] == (char)s)
return ((char *)&(ch[i]));
if (i == 0)
return (NULL);
i--;
}
return (NULL);
}