-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_memalloc_2d.c
37 lines (34 loc) · 1.22 KB
/
ft_memalloc_2d.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
33
34
35
36
37
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_memalloci_2d.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: rabougue <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2015/11/29 15:34:57 by rabougue #+# #+# */
/* Updated: 2016/09/15 17:17:26 by rabougue ### ########.fr */
/* */
/* ************************************************************************** */
#include "./includes/libft.h"
char **ft_memalloc_2d(size_t size_1, size_t size_2)
{
size_t i;
size_t j;
char **str;
i = 0;
j = 0;
str = NULL;
str = (char **)malloc(sizeof(char *) * size_1);
if (str == NULL)
return (NULL);
while (i < size_1)
{
while (j < size_2)
{
str[j] = ft_memalloc(size_2 + 1);
++j;
}
++i;
}
return (str);
}