-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_memchr.c
More file actions
33 lines (30 loc) · 1.15 KB
/
Copy pathft_memchr.c
File metadata and controls
33 lines (30 loc) · 1.15 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
31
32
33
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_memchr.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: ekutlay <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/01/08 19:11:50 by ekutlay #+# #+# */
/* Updated: 2022/01/09 21:08:34 by ekutlay ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void *ft_memchr(const void *str, int c, size_t n)
{
size_t i;
unsigned char *ptr;
ptr = (unsigned char *)str;
i = 0;
while (i < n)
{
if (*ptr == (unsigned char) c)
{
return ((void *)ptr);
}
ptr++;
i++;
}
ptr = NULL;
return ((void *)ptr);
}