-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_memalloc.c
32 lines (29 loc) · 1.12 KB
/
ft_memalloc.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_memalloc.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: erli <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2018/11/08 09:02:50 by erli #+# #+# */
/* Updated: 2018/11/09 13:05:27 by erli ### ########.fr */
/* */
/* ************************************************************************** */
#include <stdlib.h>
#include <string.h>
void *ft_memalloc(size_t n)
{
void *memzone;
char *s;
size_t i;
if (!(memzone = malloc(n)))
return (NULL);
s = (char *)memzone;
i = 0;
while (i < n)
{
s[i] = 0;
i++;
}
return (memzone);
}