-
Notifications
You must be signed in to change notification settings - Fork 1
/
ft_memcpy.c
46 lines (41 loc) · 1.58 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
36
37
38
39
40
41
42
43
44
45
46
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_memcpy.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: jede-ara <jede-ara@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/11/02 15:12:37 by jede-ara #+# #+# */
/* Updated: 2022/11/08 14:27:52 by jede-ara ### ########.fr */
/* */
/* ************************************************************************** */
/*
DESCRIÇÃO: memcpy() copia blocos de memória. Ou seja, copia n caracteres da
área de memória src para a área de memória dst. As áreas de memória não devem
se sobrepor.
*/
#include "libft.h"
void *ft_memcpy(void *dst, const void *src, size_t n)
{
size_t i;
if (!dst && !src)
return (0);
i = 0;
while (i < n)
{
((unsigned char *)dst)[i] = ((unsigned char *)src)[i];
i++;
}
return (dst);
}
/*#include <stdio.h>
#include <stddef.h>
#include <string.h>
int main(void)
{
char src[100] = "Jennifer Araujo";
char dest[100] = "Jennifer Oliveira";
size_t n = 5;
printf("o endereço de memoria de src é %p\n", (void *) &src);
printf("o endereço de memoria de dest é %p\n", (void *) &dest);
}*/