1
1
mirror of https://github.com/theoludwig/programming-challenges.git synced 2024-10-29 22:17:23 +01:00

fix(solutions): array 2D malloc initialization

This commit is contained in:
Théo LUDWIG 2023-08-10 20:19:09 +02:00
parent 5cc8bea083
commit 395cd142b8
Signed by: theoludwig
GPG Key ID: ADFE5A563D718F3B

View File

@ -13,7 +13,7 @@ void array_2D_int_print(int **array, size_t number_of_rows, size_t number_of_col
}
int **array_2D_int_input(size_t *number_of_rows, size_t *number_of_columns) {
int **array = malloc(sizeof(int));
int **array = malloc(sizeof(int) * 2);
*number_of_rows = 1;
*number_of_columns = 1;
array[0] = malloc(*number_of_columns * sizeof(int));