-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_memcpy.c
More file actions
39 lines (35 loc) · 1.26 KB
/
Copy pathft_memcpy.c
File metadata and controls
39 lines (35 loc) · 1.26 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
32
33
34
35
36
37
38
39
/* ************************************************************************** */
/* */
/* :::::::: */
/* ft_memcpy.c :+: :+: */
/* +:+ */
/* By: farodrig <farodrig@student.codam.nl> +#+ */
/* +#+ */
/* Created: 2020/11/28 08:58:42 by farodrig #+# #+# */
/* Updated: 2020/12/12 18:48:18 by farodrig ######## odam.nl */
/* */
/* ************************************************************************** */
#include "libft.h"
/*
** Copies n bytes from memory area src to memory area dst
*/
void *ft_memcpy(void *dest, const void *src, size_t len)
{
unsigned char *ptr;
unsigned char *ptr2;
unsigned int i;
if (dest == 0 && src == 0)
{
return (dest);
}
ptr = (unsigned char*)dest;
ptr2 = (unsigned char*)src;
i = 0;
while (len)
{
ptr[i] = ptr2[i];
i++;
len--;
}
return (dest);
}