-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_memset.c
54 lines (45 loc) · 1.48 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
42
43
44
45
46
47
48
49
50
51
52
53
54
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_memset.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: julmuntz <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/05/05 15:57:37 by julmuntz #+# #+# */
/* Updated: 2022/05/19 16:21:24 by julmuntz ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void *ft_memset(void *s, int c, size_t n)
{
unsigned char *a;
a = s;
while (n > 0)
{
*a = c;
a++;
n--;
}
return (s);
}
/*
#include <stdio.h>
#include <string.h>
int main(void)
{
char str[] = {1,2,3,4,5,6,7,8,9};
puts("\n- memset");
memset(str, 1, 6);
printf("%d%d%d%d%d%d%d%d%d\n",
str[0], str[1], str[2],
str[3], str[4], str[5],
str[6], str[7], str[8]);
puts("\n- ft_memset");
ft_memset(str, 1, 6);
printf("%d%d%d%d%d%d%d%d%d\n",
str[0], str[1], str[2],
str[3], str[4], str[5],
str[6], str[7], str[8]);
return (0);
}
*/