-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_memalloc.c
executable file
·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: mberger <mberger@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2014/11/08 16:21:21 by mberger #+# #+# */
/* Updated: 2014/11/11 17:21:04 by mberger ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void *ft_memalloc(size_t size)
{
size_t i;
void *tab;
char *init;
i = 0;
tab = (void*)malloc(sizeof(char) * size);
init = (char*)tab;
if (tab == NULL)
return (NULL);
while (i < size)
{
init[i] = 0;
i++;
}
return (tab);
}