-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_memset.c
More file actions
50 lines (42 loc) · 1.39 KB
/
Copy pathft_memset.c
File metadata and controls
50 lines (42 loc) · 1.39 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_memset.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: spunyapr <spunyapr@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/11/27 15:06:03 by spunyapr #+# #+# */
/* Updated: 2024/11/30 16:03:28 by spunyapr ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void *ft_memset(void *s, int c, size_t n)
{
unsigned char *p;
p = s;
while (n > 0)
{
*p = c;
n--;
p++;
}
return (s);
}
// #include <stdio.h>
// int main ()
// {
// char test[10] = "HelloWorld";
// ft_memset(test + 5, '.', sizeof(char) * 3);
// for (int i = 0; i < 10; i++)
// {
// printf("%c", test[i]);
// }
// int arr[2] = {0, 145232};
// ft_memset(arr, 65, 6);
// //printArray(arr, 2);
// char *p = arr;
// for (int i = 0; i < 8; i++)
// {
// printf("%d ", p[i]);
// }
// }