-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_memset.c
executable file
·33 lines (30 loc) · 1.12 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: dcherend <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2018/03/20 18:48:32 by dcherend #+# #+# */
/* Updated: 2018/03/31 17:31:01 by dcherend ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void *ft_memset(void *b, int c, size_t len)
{
char *str;
unsigned char ch;
size_t i;
i = 0;
ch = (unsigned char)c;
if (len)
{
str = (char*)b;
while (i < len)
{
str[i] = ch;
i++;
}
}
return ((void*)b);
}