-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathft_memcpy.c
More file actions
46 lines (42 loc) · 1.58 KB
/
Copy pathft_memcpy.c
File metadata and controls
46 lines (42 loc) · 1.58 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
40
41
42
43
44
45
46
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_memcpy.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cado-car <cado-car@student.42sp.org.br> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/07/30 20:22:59 by cado-car #+# #+# */
/* Updated: 2021/07/31 11:22:29 by cado-car ### ########lyon.fr */
/* */
/* ************************************************************************** */
/*
* LIBRARY
* #include <string.h>
* DESCRIPTION
* The memcpy() function copies n bytes from memory area src to memory area dst.
* If dst and src overlap, behavior is undefined.
* PARAMETERS
* #1. The destiny pointer in which to copy.
* #2. The source pointer to copy.
* #3. The number of bytes to copy the source string.
* RETURN VALUES
* The memcpy() function returns the original value of dst.
*/
#include "libft.h"
void *ft_memcpy(void *dst, const void *src, size_t n)
{
size_t i;
unsigned char *dstc;
unsigned char *srcc;
if (dst == NULL && src == NULL)
return (NULL);
i = 0;
dstc = (unsigned char *)dst;
srcc = (unsigned char *)src;
while (i < n)
{
dstc[i] = srcc[i];
i++;
}
return (dst);
}