-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_memset.c
32 lines (28 loc) · 1.2 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_memset.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: aviholai <aviholai@student.hive.fi> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/01/11 17:22:19 by aviholai #+# #+# */
/* Updated: 2022/01/19 16:05:01 by aviholai ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
/*
** Memset (memory set) copies the argument 'len' amount of argument value 'c'
** to a newly created char string 's' pointed by the argument '*b'.
** Returns the argument 'b'.
*/
void *ft_memset(void *b, int c, size_t len)
{
char *s;
s = (char *)b;
while (len > 0)
{
s[len - 1] = c;
len--;
}
return (b);
}