-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathft_memcpy.c
33 lines (29 loc) · 1.22 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
33
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_memcpy.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: mihykim <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/02/26 05:58:04 by mihykim #+# #+# */
/* Updated: 2020/04/03 22:02:49 by mihykim ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
/*
** - Copies 'n' bytes from memory area 'src' to memory area 'dst'.
** - Returns the original value of 'dst'.
*/
void *ft_memcpy(void *dst, const void *src, size_t n)
{
size_t i;
if (dst == 0 && src == 0)
return (dst);
i = 0;
while (i < n)
{
((unsigned char *)dst)[i] = ((unsigned char *)src)[i];
i++;
}
return (dst);
}