We use single dimensional array to store a collection of data of same type. But two-dimensional arrays are used to store tabular data. This means when the data is in the form of rows as well as columns we need a more power array to store it. Here is where two dimensional arrays are used, to data the data in the form of table. In two dimensional array declaration we specify number of rows and number of columns.
Consider the following example:
table
Rollno | Marks | Rank |
---|---|---|
49 | 95 | 1 |
12 | 87 | 2 |
17 | 79 | 3 |
In the above table there are three columns and three rows. So the declaration can be done in the following way:
SYNTAX
data type array-name [rows][columns]
array above can be declared as:
EJEMPLO
int student[3][3];
NOTE: All the rows and columns of this array are of the type Integer
Administrador de ENGGDRCAOS. Canal dedicado especialmente a la formación del estudiante que aspira a ser ingeniero. Todos los videos son Ingles. Apasionado del universo Apple, estudiante de Ingeniería y Gamer por vocación.