This chapter expands our discussion on one-dimensional arrays to two dimensional arrays. A two dimensional array is a data structure that contains a collection of cells laid out in a two dimensional grid, similar to a table with rows and columns although the values are still stored linearly in memory. Each cell in a two dimensional array can be accessed through two indexes that specify the row number and column number respectively. Like s one dimensional array, the range of each index is from zero to the size of the row or column minus one. A nested for loop is commonly used to initialize, manipulate, and access the values in a two dimensional array.
16. End of the Chapter
Answer:
Yes. But lets skip that for now. 2D arrays are usually as high as you need to go. 3D arrays get very big. A 3D array of 100
sheets of 2D arrays, where each 2D array has 100 rows and 100 columns would have 100*100*100 cells, 1,000,000 cells.
That is an awful lot of data. Usually some other type of data structure would be used.
End of the Chapter
You have reached the end this chapter. You may wish to review the following. Click on a subject that interests you to go to where it was discussed.
- array, two dimensional Two-dimensional array.
- array, row and column numbers Row and column numbering.
- bounds checking Bounds checking.
- array declaration, 2D Array declaration.
- array, 2D uneven rows Differing numbers of cells per row.
- array, length Length of a 2D array.
- array, row length Length of each row.
- array, implementation Implementation of a 2D array.
- array, 2D printing Printing a 2D array.