Files
libft/ft_memmove.c
Loïc GUEZO b88037b15a feat: add ft_memmove function
memmove:
	if the src pointer is higher than the dst pointer,
	the function copies each caracter backwards.
2025-10-04 14:43:15 +02:00

19 lines
239 B
C

#include "libft.h"
void *ft_memmove(void *dst, const void *src, size_t len)
{
if (dst <= src)
{
ft_memcpy(dst, src, len);
}
else
{
while (len > 0)
{
len--;
((char *)dst)[len] = ((char *)src)[len];
}
}
return (dst);
}