-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_memset.c
41 lines (36 loc) · 1.39 KB
/
ft_memset.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_memset.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: iziane <iziane@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/03/06 12:57:28 by iziane #+# #+# */
/* Updated: 2024/03/14 00:27:06 by iziane ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void *ft_memset(void *ptr, int x, size_t len)
{
size_t i;
unsigned char *result;
result = (unsigned char *)ptr;
i = 0;
while (i < len)
{
result[i] = (unsigned char)x;
i++;
}
return (result);
}
// int main(void)
// {
// char str[100] = "Ouey hallo Zizou";
// char test[100] = "Ouey hallo Zizou";
// memset(str, 'A', 42 * sizeof(char));
// printf("OG: %s\n", str);
// ft_memset(test, 'A', 42 * sizeof(char));
// printf("MY: %s\n", test);
// return (0);
// }
//void *ft_memset(void *ptr)