blob: 4fd8689a76ccb3cc2a06ff462b3df610a70f45d0 (
plain)
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
|
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_memchr.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/10/07 09:55:31 by cacharle #+# #+# */
/* Updated: 2020/02/13 04:28:00 by cacharle ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void *ft_memchr(const void *s, int c, size_t n)
{
size_t i;
t_ftbyte *cast_s;
cast_s = (t_ftbyte*)s;
i = -1;
while (++i < n)
if (cast_s[i] == (unsigned char)c)
return (cast_s + i);
return (NULL);
}
|