-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_memset.c
More file actions
55 lines (50 loc) · 1.4 KB
/
Copy pathft_memset.c
File metadata and controls
55 lines (50 loc) · 1.4 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
47
48
49
50
51
52
53
54
55
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_memset.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: csekakul <csekakul@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2026/01/13 09:36:21 by csekakul #+# #+# */
/* Updated: 2026/01/16 15:47:18 by csekakul ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void *ft_memset(void *s, int c, size_t n)
{
size_t i;
unsigned char *p;
p = s;
i = 0;
while (i < n)
{
p[i] = c;
i++;
}
return (s);
}
/*int main(void)
{
void *str;
unsigned char *ptr;
unsigned char *ptr2;
int i;
str = "This is a test";
ptr = memset(&str, 'a', 8);
ptr2 = ft_memset(&str, 'a', 8);
i = 0;
printf("memset ");
while (ptr[i] != '\0')
{
printf("%c", ptr[i]);
i++;
}
i = 0;
printf("\nft_memset ");
while (ptr2[i] != '\0')
{
printf("%c", ptr2[i]);
i++;
}
return (0);
}*/