-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_memset.c
More file actions
32 lines (28 loc) · 1.16 KB
/
ft_memset.c
File metadata and controls
32 lines (28 loc) · 1.16 KB
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: fsanz-ex <fsanz-ex@student.42madrid.com +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/01/13 19:13:37 by fsanz-ex #+# #+# */
/* Updated: 2023/02/09 20:11:55 by fsanz-ex ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
/*writes len bytes of value c (converted to an unsigned char) to the string b.
Returns its first argument.*/
void *ft_memset(void *b, int c, size_t len)
{
int i;
char *str;
i = 0;
str = b;
while (len > 0)
{
str[i] = (unsigned char) c;
i++;
len--;
}
return (b);
}