-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_memchr.c
More file actions
31 lines (28 loc) · 1.15 KB
/
ft_memchr.c
File metadata and controls
31 lines (28 loc) · 1.15 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
30
31
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_memchr.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: miissa <miissa@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/11/01 13:28:43 by miissa #+# #+# */
/* Updated: 2025/11/08 09:41:54 by miissa ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void *ft_memchr(const void *s, int c, size_t size)
{
size_t i;
unsigned char search;
unsigned char *ss;
i = 0;
search = (unsigned char) c;
ss = (unsigned char *) s;
while (i < size)
{
if (ss[i] == search)
return (&ss[i]);
i++;
}
return (NULL);
}