-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmallocbinstack.c
29 lines (27 loc) · 1.24 KB
/
mallocbinstack.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* mallocbinstack.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: yst-laur <[email protected] +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/03/09 14:19:25 by yst-laur #+# #+# */
/* Updated: 2022/03/09 14:19:29 by yst-laur ### ########.fr */
/* */
/* ************************************************************************** */
#include "push_swap.h"
char **mallocbinstack(int stack_a_size)
{
char **binstack;
int maxwidth;
int i;
i = -1;
maxwidth = maxbinwidth(stack_a_size);
binstack = malloc((stack_a_size + 1) * sizeof(char *));
while (++i < stack_a_size)
{
binstack[i] = malloc((maxwidth + 1) * sizeof(char));
ft_memset((void *) binstack[i], 0, maxwidth + 1);
}
return (binstack);
}