-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_memalloc.c
26 lines (23 loc) · 1.09 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_memalloc.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: malexand <malexand@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/05/07 13:00:06 by alex #+# #+# */
/* Updated: 2017/02/16 17:34:23 by malexand ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void *ft_memalloc(size_t size)
{
char *data;
size_t count;
count = 0;
if ((data = (char *)malloc(size)) == NULL)
return (NULL);
while (count < size)
data[count++] = 0;
return ((void*)data);
}