Bifalgorithm post · Computer science one · Dynamic Data Structures
How is a contiguous two-dimensional array represented using pointers?
How is a contiguous two-dimensional array represented using pointers? (Computer science one · Dynamic Data Structures) — "20. Arrays **m m[0] m[1] m[2] m[3] m[…
Ideas in this flowchart
- Contiguous two-dimensional arrays
- The pointer-to-pointers variable m is initialized to an array of pointers.
- The pointer array contains m[0] through m[3].
- A contiguous 4 × 3 array is created.
- Each pointer is initialized to its proper location in the contiguous array.
- The elements can be accessed with two-dimensional notation such as m[0][0] through m[3][2].
- The resulting structure can be treated as a two-dimensional array.
- Figure 20.2 illustrates the contiguous two-dimensional array.