2D Arrays
Subtitle
2D arrays are arrays of arrays.
Example of a 2D array
[R,C] | 0 | 1 | 2 | 3 |
---|---|---|---|---|
0 | [0,0] | [0,1] | [0,2] | [0,3] |
1 | [1,0] | [1,1] | [1,2] | [1,3] |
2 | [2,0] | [2,1] | [2,2] | [2,3] |
3 | [3,0] | [3,1] | [3,2] | [3,3] |
The table shows a 2D array with the index’s on them. Below is the same table with data in the table. |
0 | 1 | 2 | 3 | |
---|---|---|---|---|
0 | 12 | 32 | 28 | 29 |
1 | 23 | 38 | 29 | 21 |
2 | 53 | 24 | 10 | 39 |
3 | 38 | 96 | 73 | 28 |
For example if we call: |
Array[2,1]
We should get the following result.
24
Important
Make sure to always read 2d tables ROW then COLUMN