-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_memset.c
33 lines (30 loc) · 1.21 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_memset.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: damartin <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/02/01 19:03:51 by damartin #+# #+# */
/* Updated: 2022/02/10 16:34:10 by damartin ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void *ft_memset(void *str, int c, size_t n)
{
size_t i;
i = 0;
while (i < n)
{
((unsigned char *)str)[i] = c;
i++;
}
return (str);
}
// int main(void)
// {
// char str[] = "Ao infinito e alem";
// printf("%s\n", ft_memset(str, '$', 6));
// printf("%s\n", memset(str, '$', 9));
// return 0;
// }