-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_memchr.c
27 lines (24 loc) · 1.09 KB
/
ft_memchr.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_memchr.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: lenzo-pe <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/02/06 17:01:41 by lenzo-pe #+# #+# */
/* Updated: 2021/04/07 13:31:16 by lenzo-pe ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_string.h"
void *ft_memchr(const void *ptr, int c, size_t num)
{
unsigned char *str;
str = (unsigned char *)ptr;
while (num--)
{
if (*str == (unsigned char)c)
return (str);
str++;
}
return (NULL);
}