Mindmap
multidimensional arrays
Inhalt der Mindmap
multidimensional arrays
Data in multidimensional arrays are stored in tabular form (in row major order).
data_type[1st dimension][2nd dimension][]..[Nth dimension] array_name = new data_type[size1][size2]….[sizeN];
- data_type: Type of data to be stored in the array. For example: int, char, etc. dimension: The dimension of the array created. For example: 1D, 2D, etc. array_name: Name of the array size1, size2, …, sizeN: Sizes of the dimensions respectively.
Size of multidimensional arrays: The total number of elements that can be stored in a multidimensional array can be calculated by multiplying the size of all the dimensions.
A two – dimensional array can be seen as an array of one – dimensional array for easier understanding.
- A three – dimensional array can be seen as an array of two – dimensional array for easier understanding.
Declaration – Syntax: data_type[][] array_name = new data_type[x][y]; For example: int[][] arr = new int[10][20];
- Initialization – Syntax: array_name[row_index][column_index] = value; For example: arr[0][0] = 1;
Elements in two-dimensional arrays are commonly referred by x[i][j] where ‘i’ is the row number and ‘j’ is the column number.
- Elements in three-dimensional arrays are commonly referred by x[i][j][k] where ‘i’ is the array number, ‘j’ is the row number and ‘k’ is the column number.
Declaration – Syntax: data_type[][][] array_name = new data_type[x][y][z]; For example: int[][][] arr = new int[10][20][30];
- Initialization – Syntax: array_name[array_index][row_index][column_index] = value; For example: arr[0][0][0] = 1;
A three – dimensional array can be seen as a tables of arrays with ‘x’ rows and ‘y’ columns where the row number ranges from 0 to (x-1) and column number ranges from 0 to (y-1)
Informationen
- Beschreibung
- Mindmap am multidimensional arrays, erstellt von daniela rodriguez am 15/05/2019.
- Erstellt von
- daniela rodriguez
- Aufrufe
- 0
- Verlauf
-
- Erstellt von daniela rodriguez · 15 Mai 2019
- Kopiert von daniela rodriguez · 15 Mai 2019
- Bewertung