-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_memmove.c
More file actions
46 lines (44 loc) · 1.32 KB
/
Copy pathft_memmove.c
File metadata and controls
46 lines (44 loc) · 1.32 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
41
42
43
44
45
46
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_memmove.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: yelallam <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/11/01 18:21:45 by yelallam #+# #+# */
/* Updated: 2025/11/01 19:27:36 by yelallam ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void *ft_memmove(void *dest, const void *src, size_t n)
{
unsigned char *p_dst;
unsigned const char *p_src;
size_t i;
i = 0;
p_dst = dest;
p_src = src;
if (p_dst > p_src)
{
while (n-- > i)
{
p_dst[n] = p_src[n];
}
}
else
{
while (i < n)
{
p_dst[i] = p_src[i];
i++;
}
}
return (dest);
}
/*int main()
{
char dst[] = "yahya";
char const dt[] = "elallam";
ft_memmove(dst, dt, 6);
printf("%s", dst);
}*/