Complete the code to declare a 2D array of integers with 3 rows and 4 columns.
int arr[3][[1]];
The second dimension size is 4, so the array has 3 rows and 4 columns.
Complete the code to access the element in the second row and third column of a 2D array named matrix.
int value = matrix[[1]][2];
Array indices start at 0, so the second row is index 1.
Fix the error in the code to correctly initialize a 2D array with 2 rows and 3 columns.
int arr[2][3] = {{ {1, 2, 3}, [1] }};
The second row must have exactly 3 elements, so {4, 5, 6} is correct.
Fill both blanks to complete the nested loop that prints all elements of a 2D array named grid with 3 rows and 2 columns.
for(int i = 0; i < [1]; i++) { for(int j = 0; j < [2]; j++) { printf("%d ", grid[i][j]); } printf("\n"); }
The outer loop runs over rows (3), the inner loop over columns (2).
Fill all three blanks to create a 2D array named matrix with 2 rows and 3 columns, initialize it, and print the element at first row, second column.
int matrix[[1]][[2]] = {{ {1, 2, 3}, {4, 5, 6} }}; printf("%d\n", matrix[[3]][1]);
The array has 2 rows and 3 columns. The first row index is 0, so matrix[0][1] prints the second element of the first row.