Archived
1
0
This repository has been archived on 2024-10-25. You can view files and clone it, but cannot push or open issues or pull requests.
libft/ft_memmove.c

28 lines
1.2 KiB
C
Raw Permalink Normal View History

2023-11-03 16:21:15 +01:00
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_memmove.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: adjoly <adjoly@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/11/03 15:04:04 by adjoly #+# #+# */
2023-11-06 11:00:52 +01:00
/* Updated: 2023/11/05 22:05:37 by adjoly ### ########.fr */
2023-11-03 16:21:15 +01:00
/* */
/* ************************************************************************** */
#include "libft.h"
void *ft_memmove(void *dest, const void *src, size_t n)
{
2023-11-06 11:00:52 +01:00
size_t i;
i = -1;
if (dest > src)
while (n-- > 0)
((unsigned char *)dest)[n] = ((unsigned char *)src)[n];
else if (dest < src)
while (++i < n)
((unsigned char *)dest)[i] = ((unsigned char *)src)[i];
return (dest);
2023-11-03 16:21:15 +01:00
}