-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_memset.c
More file actions
43 lines (38 loc) · 1.27 KB
/
ft_memset.c
File metadata and controls
43 lines (38 loc) · 1.27 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
35
36
37
38
39
40
41
42
43
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_memset.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: muganiev <gf.black.tv@gmail.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/05/16 14:40:28 by muganiev #+# #+# */
/* Updated: 2022/06/04 23:35:12 by muganiev ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
// void *ft_memset(void *b, int c, size_t len)
// {
// size_t i;
// if (!b)
// return (NULL);
// i = 0;
// while (i < len)
// {
// *(unsigned char *)(b + i) = (unsigned char)c;
// i++;
// }
// return (b);
// }
void *ft_memset(void *buf, int c, size_t len)
{
size_t i;
char *ptr;
i = 0;
ptr = (char *)buf;
while (len > i)
{
ptr[i] = (char)c;
i++;
}
return (buf);
}