diff options
Diffstat (limited to 'max_num_moves_grid.c')
-rw-r--r-- | max_num_moves_grid.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/max_num_moves_grid.c b/max_num_moves_grid.c index 617135c..119371f 100644 --- a/max_num_moves_grid.c +++ b/max_num_moves_grid.c @@ -35,11 +35,10 @@ int maxMoves(int **grid, int grid_size, int *grid_col_size) { int main() { int g1i[4][4] = {{2, 4, 3, 5}, {5, 4, 9, 3}, {3, 4, 2, 11}, {10, 9, 13, 15}}; int g2i[3][3] = {{3, 2, 4}, {2, 1, 9}, {1, 1, 7}}; - struct two_d_arr g1, g2; - two_d_arr_init(&g1, 4, 4, g1i); - two_d_arr_init(&g2, 3, 3, g2i); - printf("%d\n", maxMoves(g1.arr, g1.row_size, g1.col_size)); // expect: 3 - printf("%d\n", maxMoves(g2.arr, g2.row_size, g2.col_size)); // expect: 0 - two_d_arr_free(&g1); - two_d_arr_free(&g2); + struct two_d_arr *g1 = two_d_arr_init(4, 4, g1i); + struct two_d_arr *g2 = two_d_arr_init(3, 3, g2i); + printf("%d\n", maxMoves(g1->arr, g1->row_size, g1->col_size)); // expect: 3 + printf("%d\n", maxMoves(g2->arr, g2->row_size, g2->col_size)); // expect: 0 + two_d_arr_free(g1); + two_d_arr_free(g2); } |