-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_memset.c
31 lines (27 loc) · 1.24 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
/* ************************************************************************** */
/* */
/* :::::::: */
/* ft_memset.c :+: :+: */
/* +:+ */
/* By: jaberkro <[email protected]> +#+ */
/* +#+ */
/* Created: 2021/10/18 20:36:21 by jaberkro #+# #+# */
/* Updated: 2022/01/12 12:05:39 by jaberkro ######## odam.nl */
/* */
/* ************************************************************************** */
#include "libft.h"
void *ft_memset(void *b, int c, size_t len)
{
size_t counter;
counter = 0;
while (counter < len)
{
((unsigned char *)b)[counter] = (unsigned char)c;
counter++;
}
return ((void *)(b));
}
/* The memset() function writes len bytes of value c (converted to an
unsigned char) to the string b.
The memset() function returns its first argument.
*/