-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_memmove.c
More file actions
40 lines (37 loc) · 1.28 KB
/
ft_memmove.c
File metadata and controls
40 lines (37 loc) · 1.28 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
34
35
36
37
38
39
40
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_memmove.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: pruthann <pruth@student.21-school.ru> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/11/14 15:39:26 by pruthann #+# #+# */
/* Updated: 2020/11/14 15:41:04 by pruthann ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void *ft_memmove(void *dst, const void *src, size_t len)
{
char *dest;
const char *src_true;
int i;
i = 0;
if (dst == NULL && src == NULL)
return (dst);
dest = (char*)dst;
src_true = (const char*)src;
if (dest >= src_true)
while (len)
{
dest[len - 1] = src_true[len - 1];
len--;
}
else
while (len)
{
dest[i] = src_true[i];
len--;
i++;
}
return (dest);
}