42_minishell/libftx/libft/ft_memcpy.c
Camille Chauvet 5a102e93a1 init
2023-01-31 14:40:15 +01: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/29 11:50:17 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 (dest);
tab1 = dest;
tab2 = (void *) src;
i = 0;
while (i < n)
{
tab1[i] = tab2[i];
i++;
}
return (tab1);
}