0
How to arrengement the array two dimensional? with c++,Thanks for answer 😊.
2 odpowiedzi
+ 2
Hey Faroug As Hashad .
let us understand what is array ,
array is a fixes size sequential collection of elements of the same data type such as integer , float , double ..
coming to two dimensional array ..
which has row and columns
syntax of 2D array is
type array_name[row_size] [column_size];
All variable save in contiguous manner in memory.
to find the total number of memory
row_size * column_size .
consider the example
Array [2][2];
I will try show the memory layout of the Array of row and column
columns
0 1 2
row 0-> | 12 | 13 | 14 |
row 1-> | 15 | 16 | 17 |
row 2 -> | 19 | 20 | 21 l |
The memory layout of the Array and the memory address from 12 to 21 just for the explanation sake.
The layout defines memory is contiguous from 12 to 21 ..
total number of memory given by 3*3=9
Hope you understood....
0
imagine that as chess board just not standard dimensions...and every field has "coordinates" so you can put needed value in needed field