-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_memmove.c
More file actions
33 lines (30 loc) · 1.25 KB
/
ft_memmove.c
File metadata and controls
33 lines (30 loc) · 1.25 KB
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
29
30
31
32
33
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_memmove.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: lpetsoan <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/05/20 09:16:51 by lpetsoan #+# #+# */
/* Updated: 2019/06/21 07:50:05 by lpetsoan ### ########.fr */
/* */
/* ************************************************************************** */
#include <string.h>
#include <stdlib.h>
#include "libft.h"
void *ft_memmove(void *dst, const void *src, size_t n)
{
unsigned char *temp_dst;
unsigned char *temp_src;
temp_dst = (unsigned char *)dst;
if (!(dst) && !(src))
return (NULL);
temp_src = (unsigned char *)ft_memalloc(n);
ft_memcpy(temp_src, src, n);
while (n > 0)
{
*temp_dst++ = *temp_src++;
n--;
}
return (dst);
}