-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_memcpy.c
More file actions
executable file
·32 lines (29 loc) · 1.14 KB
/
Copy pathft_memcpy.c
File metadata and controls
executable file
·32 lines (29 loc) · 1.14 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_memcpy.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: anben <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/05/24 11:10:17 by anben #+# #+# */
/* Updated: 2019/06/06 15:19:41 by anben ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void *ft_memcpy(void *dest, const void *src, size_t n)
{
size_t i;
char *dpos;
const char *spos;
i = 0;
dpos = dest;
spos = src;
while (i < n)
{
if (n == 0 || dpos == spos)
return (dest);
dpos[i] = spos[i];
i++;
}
return (dest);
}