C++ Programming Blog

 
 
 

Image

 #include<iostream.h>
 #include<conio.h>


 main( )
    {
       clrscr();

       const int r=3;
       const int c=3;

       int array[r][c],i,j;

       cout<<\"\\n Enter the contents of the 2D array row by row are :\\n\"<<endl;
       for(i=0;i<r;i++)
      {
         for(j=0;j<c;j++)
        cin>>*(*(array+i)+j);

         cout<<endl;
      }

       clrscr();

       cout<<\"\\n The content of the 2D array row by row are :\\n\"<<endl;
       for(i=0;i<r;i++)
      {
         for(j=0;j<c;j++)
        cout<<\"  array element [\"<<i<<\"][\"<<j<<\"]  =  \"<<
                              *(*(array+i)+j)<<endl;

         cout<<endl;
      }

       getch();
       return 0;
    }

 
 
Didn't find what you were looking for? Find more on Program to illustrate the 2D array of int using pointers