-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_create_table.c
40 lines (37 loc) · 1.34 KB
/
ft_create_table.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
38
39
40
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_create_table.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: akerkeb <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/01/21 23:12:33 by akerkeb #+# #+# */
/* Updated: 2016/01/21 23:12:35 by akerkeb ### ########.fr */
/* */
/* ************************************************************************** */
#include "fillit.h"
char **ft_create_table(int size)
{
int len_cub;
int x;
int y;
char **final_tab;
len_cub = 2;
while (ft_power_x(len_cub) < (size * 4))
len_cub++;
final_tab = (char **)ft_memalloc(sizeof(char *) * (len_cub + 1));
x = 0;
while (x < len_cub)
{
final_tab[x] = (char *)ft_memalloc(sizeof(char ) * (len_cub + 2));
y = 0;
while (y < len_cub)
{
final_tab[x][y] = '.';
y++;
}
final_tab[x][y] = '\n';
x++;
}
return (final_tab);
}