-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_memset.c
40 lines (36 loc) · 1.2 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_memset.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: sde-silv <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/05/04 13:05:33 by sde-silv #+# #+# */
/* Updated: 2023/06/12 14:50:43 by sde-silv ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
/*
#include<string.h>
*/
void *ft_memset(void *s, int c, size_t n)
{
unsigned char *p;
p = s;
while (n > 0)
{
*p = (unsigned char)c;
p ++;
n --;
}
return (s);
}
/*
int main(void)
{
char arr[6] = "Hello";
// write(1, memset(arr, 'A', 4), 5);
write(1, ft_memset(arr, 'A', 4), 5);
return (0);
}
*/