42_minishell/libftx/libft/ft_memcpy.c

33 lines
1.1 KiB
C
Raw Normal View History

2023-01-31 08:40:15 -05:00
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* 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);
}