-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_make_map.c
More file actions
executable file
·60 lines (54 loc) · 1.46 KB
/
ft_make_map.c
File metadata and controls
executable file
·60 lines (54 loc) · 1.46 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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_make_map.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: aorji <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/12/16 18:12:49 by aorji #+# #+# */
/* Updated: 2017/12/16 18:12:55 by aorji ### ########.fr */
/* */
/* ************************************************************************** */
#include "fillit.h"
char **ft_make_map(int size)
{
char **map;
int n;
n = size;
if (!(map = (char**)malloc(sizeof(char*) * (size + 1))))
return (NULL);
map[size] = NULL;
while (n)
{
map[n - 1] = (char *)malloc(sizeof(char) * (size + 1));
ft_memset(map[n - 1], 46, size);
map[n - 1][size] = '\0';
n--;
}
return (map);
}
int ft_count_s_root(int number)
{
int i;
int c;
i = 0;
c = 2;
while (i < 10)
{
if (c * c >= number)
return (c);
else
c++;
i++;
}
return (0);
}
void show(char **all)
{
while (*all)
{
ft_putstr(*all);
ft_putchar('\n');
all++;
}
}