-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathft_memchr.c
executable file
·29 lines (26 loc) · 1.1 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
28
29
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_memchr.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: rel-fila <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/10/16 13:41:19 by rel-fila #+# #+# */
/* Updated: 2022/10/16 13:42:51 by rel-fila ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
#include <stdio.h>
void *ft_memchr(const void *str, int c, size_t n)
{
unsigned char *s;
s = (unsigned char *) str;
while (n > 0)
{
if (*s == (unsigned char)c)
return (s);
s++;
n--;
}
return (NULL);
}