aboutsummaryrefslogtreecommitdiff
path: root/find_distinct_ball_colour.c
diff options
context:
space:
mode:
Diffstat (limited to 'find_distinct_ball_colour.c')
-rw-r--r--find_distinct_ball_colour.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/find_distinct_ball_colour.c b/find_distinct_ball_colour.c
index 6c08491..c542faf 100644
--- a/find_distinct_ball_colour.c
+++ b/find_distinct_ball_colour.c
@@ -131,11 +131,12 @@ int *queryResults(int limit, int **queries, int queriesSize,
int main() {
int q1i[4][2] = {{1, 4}, {2, 5}, {1, 3}, {3, 4}}, rs1;
int q2i[5][2] = {{0, 1}, {1, 2}, {2, 2}, {3, 4}, {4, 5}}, rs2;
- struct two_d_arr q1, q2;
- two_d_arr_init(&q1, ARRAY_SIZE(q1i), ARRAY_SIZE(q1i[0]), q1i);
- two_d_arr_init(&q2, ARRAY_SIZE(q2i), ARRAY_SIZE(q2i[0]), q2i);
- int *qr1 = queryResults(4, q1.arr, q1.row_size, q1.col_size, &rs1);
- int *qr2 = queryResults(4, q2.arr, q2.row_size, q2.col_size, &rs2);
+ struct two_d_arr *q1 =
+ two_d_arr_init(ARRAY_SIZE(q1i), ARRAY_SIZE(q1i[0]), q1i);
+ struct two_d_arr *q2 =
+ two_d_arr_init(ARRAY_SIZE(q2i), ARRAY_SIZE(q2i[0]), q2i);
+ int *qr1 = queryResults(4, q1->arr, q1->row_size, q1->col_size, &rs1);
+ int *qr2 = queryResults(4, q2->arr, q2->row_size, q2->col_size, &rs2);
for (int i = 0; i < rs1; i++)
printf("%d ", qr1[i]); // expect: 1 2 2 3
printf("\n");
@@ -144,6 +145,6 @@ int main() {
printf("\n");
free(qr1);
free(qr2);
- two_d_arr_free(&q1);
- two_d_arr_free(&q2);
+ two_d_arr_free(q1);
+ two_d_arr_free(q2);
}