-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_memset.c
30 lines (27 loc) · 1.17 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_memset.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: agarijo- <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/09/30 11:20:24 by agarijo- #+# #+# */
/* Updated: 2022/11/02 18:51:21 by agarijo- ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void *ft_memset(void *b, int c, size_t len)
{
unsigned char cast_c;
unsigned long counter;
char *cast_b;
counter = 0;
cast_c = (unsigned char) c;
cast_b = (char *)b;
while (len != 0 && counter <= len - 1)
{
*(cast_b + counter) = cast_c;
counter++;
}
return (cast_b);
}