-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_memset.c
39 lines (35 loc) · 1.22 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: gudaniel <gudaniel@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/04/09 13:57:46 by gudaniel #+# #+# */
/* Updated: 2024/04/09 13:57:49 by gudaniel ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void *ft_memset(void *s, int c, size_t n)
{
unsigned char *p;
unsigned char value;
size_t i;
i = 0;
p = (unsigned char *)s;
value = (unsigned char)c;
while (i < n)
{
p[i] = value;
i++;
}
return (s);
}
/* int main()
{
char str[50] = "Gustavo This is memset";
puts(str);
ft_memset(str, '-', 7);
puts(str);
return(0);
} */