-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_memcpy.c
43 lines (39 loc) · 1.43 KB
/
ft_memcpy.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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_memcpy.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: mbin-nas <mbin-nas@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/19 16:08:27 by mbin-nas #+# #+# */
/* Updated: 2022/07/27 14:57:01 by mbin-nas ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
#include <stdio.h>
void *ft_memcpy(void *dst, const void *src, size_t num)
{
size_t i;
char *csrc;
char *cdest;
if (!src && !dst)
return (NULL);
csrc = (char *)src;
cdest = (char *)dst;
i = 0;
while (i < num)
{
cdest[i] = (unsigned char)csrc[i];
i++;
}
return (cdest);
}
// int main()
// {
// char mystring[50] = "YELLLO TO FUN WORLD BABY!!!!!!!";
// char dst[50] = "HELLO LADIES, ITS JOHNNY!";
// printf("Before: %s\n", dst);
// ft_memcpy(dst, mystring, 30);
// printf("After: %s\n", dst);
// return(0);
// }