-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_memalloc.c
More file actions
30 lines (27 loc) · 1.13 KB
/
ft_memalloc.c
File metadata and controls
30 lines (27 loc) · 1.13 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_memalloc.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: ibohonos <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/10/27 14:50:36 by ibohonos #+# #+# */
/* Updated: 2017/10/27 14:50:41 by ibohonos ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void *ft_memalloc(size_t size)
{
char *c;
size_t i;
if (size == 0)
return (NULL);
c = (char *)malloc(sizeof(char) * size);
if (c == NULL)
return (NULL);
i = 0;
while (i < size)
c[i++] = 0;
c[i] = '\0';
return ((void *)c);
}