-
Notifications
You must be signed in to change notification settings - Fork 1
/
ft_memset.c
38 lines (33 loc) · 1.27 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_memset.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: mcombeau <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/11/22 13:48:14 by mcombeau #+# #+# */
/* Updated: 2021/12/03 12:05:11 by mcombeau ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
/*
DESCRIPTION :
The function ft_memset fills the first len bytes of the memory area
pointed to by b with the byte c. Both b and c are interpreted as
unsigned char.
RETURN VALUE :
A pointer to memory area s.
*/
void *ft_memset(void *b, int c, size_t len)
{
unsigned char *p;
unsigned char ch;
p = (unsigned char *)b;
ch = c;
while (len--)
{
*p = ch;
p++;
}
return (b);
}