Chapter 8: Multi-Dimensional Arrays Flashcards
1
Q
What’s a two-dimensional array?
A
An array that contains other arrays as its elements, it can form a table (5x5).
2
Q
What’s the syntax for declaring a two-dimensional array?
A
elementType [] [] arrayRefVar;
EXAMPLE
int[][] matrix;
3
Q
What are the two indexes in a multi-dimensional array?
A
Row index and column index
4
Q
What is a ragged array and how does it work?
A
A multi-dimensional array is technically multiple single row arrays stored together in an array. You can have different length arrays inside a multi array, which is called a ragged array.
5
Q
What’s a common way to process a two-way array?
A
Nested for loops. The loop for entering columns should be nested inside the loop for rows.