-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_memchr.c
More file actions
31 lines (28 loc) · 1.1 KB
/
ft_memchr.c
File metadata and controls
31 lines (28 loc) · 1.1 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_memchr.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: misung <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/12/09 15:39:41 by misung #+# #+# */
/* Updated: 2021/12/09 15:45:03 by misung ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void *ft_memchr(void *ptr, int value, size_t num)
{
unsigned char *pt;
size_t i;
pt = ptr;
i = 0;
while (i < num)
{
if (pt[i] == (unsigned char)value)
{
return (pt + i);
}
i++;
}
return (NULL);
}