-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_memmove.c
28 lines (25 loc) · 1.11 KB
/
ft_memmove.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_memmove.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: gasouza <gasouza@student.42sp.org.br> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/04/12 21:07:56 by gasouza #+# #+# */
/* Updated: 2022/04/28 17:46:35 by gasouza ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void *ft_memmove(void *dst, const void *src, size_t n)
{
void *tmp;
tmp = dst;
while (n--)
{
if (dst < src)
*(char *) tmp++ = *(char *) src++;
else
*(char *)(dst + n) = *(char *)(src + n);
}
return (dst);
}