-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_memset.c
37 lines (33 loc) · 1.27 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
33
34
35
36
37
/* ************************************************************************** */
/* */
/* :::::::: */
/* ft_memset.c :+: :+: */
/* +:+ */
/* By: kgajadie <[email protected]> +#+ */
/* +#+ */
/* Created: 2020/11/17 15:31:12 by kgajadie #+# #+# */
/* Updated: 2020/11/26 14:11:54 by kawish ######## odam.nl */
/* */
/* ************************************************************************** */
#include "libft.h"
/*
** DESCRIPTION
** The memset() function writes len bytes of value c (converted to an
** unsigned char) to the string b.
**
** RETURN VALUES
** The memset() function returns its first argument.
*/
void *ft_memset(void *b, int c, size_t len)
{
size_t i;
unsigned char *new_ptr;
i = 0;
new_ptr = b;
while (i < len)
{
new_ptr[i] = (unsigned char)c;
i++;
}
return (b);
}