-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_memcpy.c
More file actions
39 lines (36 loc) · 1.27 KB
/
ft_memcpy.c
File metadata and controls
39 lines (36 loc) · 1.27 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_memcpy.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: sudaniel <sudaniel@student.42heilbronn.de +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/10/09 08:27:16 by sudaniel #+# #+# */
/* Updated: 2024/10/09 10:40:52 by sudaniel ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void *ft_memcpy(void *dst, const void *src, size_t n)
{
unsigned char *s;
unsigned char *d;
s = (unsigned char *)src;
d = (unsigned char *)dst;
if (d || s)
while (n--)
*d++ = *s++;
return (dst);
}
/*
int main(void)
{
char *src = "Hello";
char dst[10];
char d[10];
ft_memcpy(d, src, 5);
memcpy(dst, src, 5);
printf("%s\n", dst);
printf("%s\n", d);
return (0);
}
*/