Class 11 Compter C++

Two Dimensional Array-
The two dimensional Array can hold the data value in the form of table containing row and column.
 Double dimensional Array is also useful to solvee the matrix.
 The data is stored in two dimensional horizontal as well as vertical

Syntax-
  data type arrayname[row size][columnsize]

 example-
    int a[2][2];

 intialization-

     a[ ][ ]={ {1,2}, {3,4}};
                or
     a[ 2 ][ 2 ]={ {1,2}, {3,4}};

Reading 
   int a[ 3 ][ 3 ], i, j;
  for(i=0; i<3; i++)
  cin>>a[ i ][ j ];

Printing 
 int a[ 3 ][ 3 ], i, j;

 for( i=0; i<3; i++)
  {
   for(j=0; j<3; j++)
         cout<<a[ i ][ j ]<<" ";

Comments