-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_memcpy.c
53 lines (48 loc) · 1.42 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
47
48
49
50
51
52
53
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_memcpy.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: sde-silv <sde-silv@student.42berlin.de> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/05/22 13:40:18 by sde-silv #+# #+# */
/* Updated: 2023/06/12 15:01:05 by sde-silv ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
/*
#include <string.h>
*/
void *ft_memcpy(void *dest, const void *src, size_t n)
{
char *char_src;
char *char_dest;
size_t i;
if (!dest && !src)
return (NULL);
char_src = (char *)src;
char_dest = (char *)dest;
i = 0;
while (i < n)
{
char_dest[i] = char_src[i];
i ++;
}
return (dest);
}
/*
int main(void)
{
char src[12] = "Hello World!";
char dest[12];
char *rtn;
int n;
n = 5;
write (1,src, 12);
write (1, "\n", 1);
rtn = ft_memcpy(((void *)0), ((void *)0), 5);
write(1,rtn, n);
write (1, "\n", 1);
return (0);
}
*/