42_libft/ft_memcpy.c
Camille Chauvet 1d0f0b1901 m
2022-09-27 16:29:23 +02:00

33 lines
1.1 KiB
C

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_memcpy.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/09/27 09:42:11 by cchauvet #+# #+# */
/* Updated: 2022/09/27 15:07:20 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void *ft_memcpy(void *dest, const void *src, size_t n)
{
char *tab1;
char *tab2;
size_t i;
if (dest == NULL || src == NULL)
return (NULL);
tab1 = dest;
tab2 = (void *) src;
i = 0;
while (i < n)
{
tab1[i] = tab2[i];
i++;
}
return (tab1);
}