-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_memset.c
36 lines (33 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_memset.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: thuy-ngu <thuy-ngu@student.42lisboa.com +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/10/02 21:22:25 by thuy-ngu #+# #+# */
/* Updated: 2023/10/13 14:51:28 by thuy-ngu ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void *ft_memset(void *s, int c, size_t n)
{
size_t i;
unsigned char *ptr;
i = 0;
ptr = (unsigned char *)s;
while (i < n)
{
ptr[i] = c;
i++;
}
return (s);
}
/*int main()
{
char s[] = "something";
int c = '*';
size_t n = ft_strlen(s);
printf("%s\n", s);
printf("%s\n", (char *)ft_memset(s, c, n));
}*/