Given two 3x3 arrays of integer , x1 and x2 , write the code needed to copy every value from x1 to its corresponding element in x2 .

So far I have

void main()
{
int x[3][3];
for(i=0; i<x1, i++)
{
for(j=0; j<x2, i++)
{
x[i][j]=i;
cout<<x[i][j]<<" ";
}
}
}

2 answers

what's with the cout?

you need x2[i][j] = x1[i][j]

i goes from 0..2 and so does j.

x1 and x2 are the arrays, not the bounds on i and j.
for(int i=0; i<3;i++){
for(int j=0; j<3;j++){
x2[i][j]=x1[i][j];}}