-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_memset.c
39 lines (33 loc) · 1.16 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_memset.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: lpicoli- < lpicoli-@student.42porto.com +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/11/05 21:04:47 by lpicoli- #+# #+# */
/* Updated: 2022/11/17 22:35:41 by lpicoli- ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void *ft_memset(void *s, int c, size_t n)
{
unsigned char *p;
p = s;
while (n > 0)
{
*p = c;
p++;
n--;
}
return (s);
}
/*int main()
{
char s[20];
size_t n = 4;
ft_memset(s, 'a', n);
puts(s);
memset(s, 'B', n);
puts(s);
}*/