-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_memcpy.c
More file actions
30 lines (27 loc) · 1.2 KB
/
ft_memcpy.c
File metadata and controls
30 lines (27 loc) · 1.2 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_memcpy.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: kokada <kokada@student.42tokyo.jp> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/05/18 16:31:41 by kokada #+# #+# */
/* Updated: 2023/05/20 15:34:11 by kokada ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void *ft_memcpy(void *restrict dst, const void *restrict src, size_t n)
{
unsigned char *dst_cpy;
unsigned char *src_cpy;
dst_cpy = (unsigned char *)dst;
src_cpy = (unsigned char *)src;
if (dst == NULL && src == NULL)
return (NULL);
while (n)
{
dst_cpy[n - 1] = src_cpy[n - 1];
n--;
}
return (dst);
}