-
Notifications
You must be signed in to change notification settings - Fork 2
/
libft_memory.c
39 lines (34 loc) · 1.24 KB
/
libft_memory.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
30
31
32
33
34
35
36
37
38
39
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* libft_memory.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: jkong <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/05/21 15:31:13 by jkong #+# #+# */
/* Updated: 2022/06/22 17:06:09 by jkong ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void *ft_memset(void *b, int c, size_t len)
{
size_t i;
i = 0;
while (i < len)
((unsigned char *)b)[i++] = (unsigned char)c;
return (b);
}
void *ft_memcpy(void *dst, const void *src, size_t n)
{
size_t i;
if (src != dst)
{
i = 0;
while (i < n)
{
((unsigned char *)dst)[i] = ((const unsigned char *)src)[i];
i++;
}
}
return (dst);
}