aboutsummaryrefslogtreecommitdiff
path: root/count_submatrices_all_ones.c
diff options
context:
space:
mode:
Diffstat (limited to 'count_submatrices_all_ones.c')
-rw-r--r--count_submatrices_all_ones.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/count_submatrices_all_ones.c b/count_submatrices_all_ones.c
index ab9c140..184651d 100644
--- a/count_submatrices_all_ones.c
+++ b/count_submatrices_all_ones.c
@@ -34,11 +34,12 @@ int numSubmat(int **mat, int matSize, int *matColSize) {
int main() {
int m1i[3][3] = {{1, 0, 1}, {1, 1, 0}, {1, 1, 0}},
m2i[3][4] = {{0, 1, 1, 0}, {0, 1, 1, 1}, {1, 1, 1, 0}};
- struct two_d_arr m1, m2;
- two_d_arr_init(&m1, ARRAY_SIZE(m1i), ARRAY_SIZE(m1i[0]), m1i);
- two_d_arr_init(&m2, ARRAY_SIZE(m2i), ARRAY_SIZE(m2i[0]), m2i);
- printf("%d\n", numSubmat(m1.arr, m1.row_size, m1.col_size)); // expect: 13
- printf("%d\n", numSubmat(m2.arr, m2.row_size, m2.col_size)); // expect: 24
- two_d_arr_free(&m1);
- two_d_arr_free(&m2);
+ struct two_d_arr *m1 =
+ two_d_arr_init(ARRAY_SIZE(m1i), ARRAY_SIZE(m1i[0]), m1i);
+ struct two_d_arr *m2 =
+ two_d_arr_init(ARRAY_SIZE(m2i), ARRAY_SIZE(m2i[0]), m2i);
+ printf("%d\n", numSubmat(m1->arr, m1->row_size, m1->col_size)); // expect: 13
+ printf("%d\n", numSubmat(m2->arr, m2->row_size, m2->col_size)); // expect: 24
+ two_d_arr_free(m1);
+ two_d_arr_free(m2);
}