diff options
Diffstat (limited to 'count_num_complete_component.c')
-rw-r--r-- | count_num_complete_component.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/count_num_complete_component.c b/count_num_complete_component.c index a6ede23..8051246 100644 --- a/count_num_complete_component.c +++ b/count_num_complete_component.c @@ -61,13 +61,14 @@ int countCompleteComponents(int n, int **edges, int edgesSize, int main() { int e1i[4][2] = {{0, 1}, {0, 2}, {1, 2}, {3, 4}}, e2i[5][2] = {{0, 1}, {0, 2}, {1, 2}, {3, 4}, {3, 5}}; - struct two_d_arr e1, e2; - two_d_arr_init(&e1, ARRAY_SIZE(e1i), ARRAY_SIZE(e1i[0]), e1i); - two_d_arr_init(&e2, ARRAY_SIZE(e2i), ARRAY_SIZE(e2i[0]), e2i); - printf("%d\n", countCompleteComponents(6, e1.arr, e1.row_size, - e1.col_size)); // expect: 3 - printf("%d\n", countCompleteComponents(6, e2.arr, e2.row_size, - e2.col_size)); // expect: 1 - two_d_arr_free(&e1); - two_d_arr_free(&e2); + struct two_d_arr *e1 = + two_d_arr_init(ARRAY_SIZE(e1i), ARRAY_SIZE(e1i[0]), e1i); + struct two_d_arr *e2 = + two_d_arr_init(ARRAY_SIZE(e2i), ARRAY_SIZE(e2i[0]), e2i); + printf("%d\n", countCompleteComponents(6, e1->arr, e1->row_size, + e1->col_size)); // expect: 3 + printf("%d\n", countCompleteComponents(6, e2->arr, e2->row_size, + e2->col_size)); // expect: 1 + two_d_arr_free(e1); + two_d_arr_free(e2); } |