-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_memchr.c
28 lines (25 loc) · 1.07 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_memchr.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: xvan-ham <xvan-ham@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/11/09 11:38:47 by xvan-ham #+# #+# */
/* Updated: 2019/11/27 13:57:23 by xvan-ham ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void *ft_memchr(const void *s, int c, size_t n)
{
const char *sc;
sc = (const char *)s;
while (n > 0)
{
if (*sc == c)
return ((void *)sc);
n--;
sc++;
}
return (0);
}