2D ARRAY IN MEMORY
void main()
{
int i,j;
int ar1[2][3],ar2[2][3], ar3[2][3];
for(i=0;i<2;i++)
{
for(j=0;j<3;j++)
{
cout<<“Enter array element of 1st array at row = “<<i+1 <<” and column = “<<j+1;
cin>>ar1[i][j]);
cout<<” array element of 2nd array at row = “<<i+1 <<” and column = ” <<j+1;
cin>>ar2[i][j]);
ar3[i][j]=ar1[i][j]+ar2[i][j];
}
}
//Displying array elements
//1st Array
for(i=0;i=2;j++)
{
cout<<“nElements of 2nd arrayn”;
for(i=0;i=3;j++)
cout<<ar2[i][j]);
}
//3rd Array
for(i=0;i=2;j++)
{
cout<<“nElements of 3rd arrayn”;
for(i=0;i=3;j++)
cout<<ar2[i][j]);
}
}
Your output is
23 | 56 | 45 | 88 | 67 | 19 |
12220 12222 12224 12226 12228 12230