-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_memcpy.c
32 lines (29 loc) · 1.26 KB
/
ft_memcpy.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_memcpy.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: msubtil- <msubtil-@student.42sp.org.br> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/04/05 19:49:30 by msubtil- #+# #+# */
/* Updated: 2022/04/26 11:12:39 by msubtil- ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void *ft_memcpy(void *dest, const void *src, size_t n)
{
size_t byte_offset;
t_uchar *aux_dest;
t_uchar *aux_src;
byte_offset = 0;
aux_src = (t_uchar *) src;
aux_dest = (t_uchar *) dest;
if (dest == NULLPTR && src == NULLPTR)
return (NULLPTR);
while (byte_offset < n)
{
*(aux_dest + byte_offset) = *(aux_src + byte_offset);
byte_offset++;
}
return (dest);
}