-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_memcpy.c
32 lines (29 loc) · 1.18 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_memcpy.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: lpires-n <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/06/01 00:19:06 by lpires-n #+# #+# */
/* Updated: 2022/06/05 00:35:48 by lpires-n ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void *ft_memcpy(void *s1, const void *s2, size_t n)
{
size_t i;
unsigned char *ss1;
unsigned char *ss2;
i = 0;
ss1 = (unsigned char *)s1;
ss2 = (unsigned char *)s2;
if (ss1 == NULL && ss2 == NULL)
return (NULL);
while (n--)
{
ss1[i] = ss2[i];
i++;
}
return ((void *)ss1);
}