-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_memset.c
More file actions
34 lines (30 loc) · 1.17 KB
/
ft_memset.c
File metadata and controls
34 lines (30 loc) · 1.17 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
33
34
/* ************************************************************************** */
/* */
/* :::::::: */
/* ft_memset.c :+: :+: */
/* +:+ */
/* By: farodrig <farodrig@student.codam.nl> +#+ */
/* +#+ */
/* Created: 2020/11/27 11:13:40 by farodrig #+# #+# */
/* Updated: 2020/12/12 18:49:22 by farodrig ######## odam.nl */
/* */
/* ************************************************************************** */
#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 *str, int c, size_t len)
{
unsigned char *ptr;
unsigned int i;
ptr = str;
i = 0;
while (len)
{
ptr[i] = c;
i++;
len--;
}
return (str);
}