-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_memcpy.c
More file actions
42 lines (38 loc) · 1.31 KB
/
Copy pathft_memcpy.c
File metadata and controls
42 lines (38 loc) · 1.31 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: wkrati <wkrati@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/10/15 16:53:18 by wkrati #+# #+# */
/* Updated: 2025/10/24 15:40:29 by wkrati ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void *ft_memcpy(void *dst, const void *src, size_t n)
{
size_t i;
unsigned char *d;
const unsigned char *s;
if (!dst && !src)
return (NULL);
d = (unsigned char *)dst;
s = (const unsigned char *)src;
i = 0;
while (i < n)
{
d[i] = s[i];
i++;
}
return (dst);
}
/*#include <stdio.h>
int main()
{
char src[] = "1337";
char dst[10] = "hello";
ft_memcpy(dst, src, 5);
printf("%s\n", dst);
return (0);
}*/