-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_memchr.c
More file actions
29 lines (26 loc) · 1.12 KB
/
Copy pathft_memchr.c
File metadata and controls
29 lines (26 loc) · 1.12 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_memchr.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: user <user@student.42tokyo.jp> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/04/29 15:30:00 by user #+# #+# */
/* Updated: 2023/04/29 15:30:00 by user ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void *ft_memchr(const void *s, int c, size_t n)
{
unsigned char *u_s;
unsigned char u_c;
u_s = (unsigned char *)s;
u_c = (unsigned char)c;
while (n--)
{
if (*u_s == u_c)
return ((void *)u_s);
u_s++;
}
return (NULL);
}