-
Notifications
You must be signed in to change notification settings - Fork 0
/
create_matrix.c
executable file
·31 lines (28 loc) · 1.19 KB
/
create_matrix.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* create_matrix.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: ioleksiu <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/08/15 19:51:25 by ioleksiu #+# #+# */
/* Updated: 2017/08/15 19:51:32 by ioleksiu ### ########.fr */
/* */
/* ************************************************************************** */
#include "lem_in.h"
void create_matrix(t_lemin *a)
{
int i;
int j;
i = -1;
a->matrix = (int**)malloc(sizeof(int *) * a->room_num);
while (++i < a->room_num)
a->matrix[i] = (int*)malloc(sizeof(int) * a->room_num);
i = -1;
while (++i < a->room_num)
{
j = -1;
while (++j < a->room_num)
a->matrix[i][j] = 0;
}
}