-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_memcpy.c
32 lines (29 loc) · 1.13 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: mriant <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/11/26 09:31:58 by mriant #+# #+# */
/* Updated: 2021/12/08 11:54:25 by mriant ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void *ft_memcpy(void *s1, const void *s2, size_t n)
{
char *str1;
char *str2;
size_t i;
if (!s2 && !s1 && n > 0)
return (NULL);
str1 = s1;
str2 = (char *) s2;
i = 0;
while (i < n)
{
str1[i] = str2[i];
i ++;
}
return (s1);
}