-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_memcpy.c
35 lines (31 loc) · 1.29 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: ldel-val <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/09/17 14:38:22 by ldel-val #+# #+# */
/* Updated: 2024/10/10 19:46:35 by ldel-val ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void *ft_memcpy(void *dest, const void *src, size_t n)
{
while (n)
{
((char *)dest)[n - 1] = ((char *)src)[n - 1];
n--;
}
return (dest);
}
/*
int main (void)
{
char dest[] = "viva la vida";
char src[] = "me voy a la luna";
size_t n = 999;
printf("resultado original: %s\n", (char*)memcpy(dest, src, n));
// printf("resultado mia: %s\n", (char*)ft_memcpy(dest, src, n));
return (0);
}*/