-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_memset.c
33 lines (29 loc) · 1.18 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: zelhajou <zelhajou@student.1337.ma> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/10/18 15:28:07 by zelhajou #+# #+# */
/* Updated: 2022/11/19 20:42:55 by zelhajou ### ########.fr */
/* */
/* ************************************************************************** */
/*
ft_memset() sets the first len bytes of the memory area pointed to by
s to the value specified by c
*/
#include "libft.h"
void *ft_memset(void *s, int c, size_t n)
{
size_t i;
unsigned char *obj;
i = 0;
obj = (unsigned char *)s;
while (i < n)
{
obj[i] = (unsigned char)c;
i++;
}
return (obj);
}