-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_memcpy.c
More file actions
42 lines (37 loc) · 1.3 KB
/
ft_memcpy.c
File metadata and controls
42 lines (37 loc) · 1.3 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_memcpy.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: thfranco <thfranco@student.42.rio> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/11/04 11:26:09 by thfranco #+# #+# */
/* Updated: 2023/11/04 11:26:12 by thfranco ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void *ft_memcpy(void *dest, const void *src, size_t n)
{
size_t i;
char *d;
char *s;
s = (char *)src;
d = (char *)dest;
i = 0;
if (!(src || dest))
return (NULL);
while (i < n)
{
d[i] = s[i];
i++;
}
return (dest);
}
/*int main(void)
{
char dest[40];
char src[] = "ola";
ft_memcpy(dest, src, sizeof(dest));
printf("%s",(char *)dest);
return (0);
}*/