-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_memcpy.c
35 lines (31 loc) · 1.42 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
34
35
/* ************************************************************************** */
/* */
/* :::::::: */
/* ft_memcpy.c :+: :+: */
/* +:+ */
/* By: jaberkro <[email protected]> +#+ */
/* +#+ */
/* Created: 2021/10/18 20:50:02 by jaberkro #+# #+# */
/* Updated: 2021/10/18 21:01:04 by jaberkro ######## odam.nl */
/* */
/* ************************************************************************** */
#include "libft.h"
void *ft_memcpy(void *dst, const void *src, size_t n)
{
size_t counter;
counter = 0;
if (!(dst == NULL && src == NULL))
{
while (counter < n)
{
((unsigned char *)dst)[counter] = ((unsigned char *)src)[counter];
counter++;
}
}
return (dst);
}
/* The memcpy() function copies n bytes from memory area src to memory area
dst. If dst and src overlap, behavior is undefined. Applications in
which dst and src might overlap should use memmove(3) instead.
The memcpy() function returns the original value of dst.
*/