-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_memcpy.c
More file actions
39 lines (33 loc) · 1.29 KB
/
Copy pathft_memcpy.c
File metadata and controls
39 lines (33 loc) · 1.29 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* memcpy.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: dramos-h <dramos-h@student.42urduli> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/11/29 13:17:50 by dramos-h #+# #+# */
/* Updated: 2022/11/29 13:17:52 by dramos-h ### ########.fr */
/* */
/* ************************************************************************** */
// pasar unas cadenas a otras
#include "libft.h"
void *ft_memcpy(void *dst, const void *src, size_t n)
{
size_t i;
i = 0;
if (src == NULL && dst == NULL)
return (0);
while (i < n)
{
((unsigned char *)dst)[i] = ((unsigned char *)src)[i];
i++;
}
return (dst);
}
/* int main(void)
{
char src[] = "abdef";
char dst[] = "xxxxxxxxxxxxxxxx";
printf("%s\n", ft_memcpy(dst, src, 5));
return(0);
} */