In line one swap is declared as an int and is initialized with an int value.
In line two swap is used as a 2 dimensional array. swap can't be both an int and a 2 dimensional array. swap was declared as an int and never as a 2 dimensional array. Therefore the compiler is telling you it can't be both and it can't convert from one to the other.
Even if i remove the cout<<swap[m][k];
i still have the runtime error. i think the [m+1] jumps the loop resriction of <10 , because I say m+1 it goes to 9+1 , but I don't know how to solve this probelm of for loop withh ++
and you use index m+1 where m ranges from 0 to less the 3 then you are indeed overwriting the end of the array with m + 1 as an index. To fix it prevent m from ever being the same size as the last valid index for m. So in this case make the outer loop go from 0 to 2. Say something like this:
const int MAXROW = 3;
const int MAXCOL = 2;
for(in m = 0; m < MAXROW - 1; ++m)
i got the answer for ur question (swaping matrix elements)
following is the code
//take the values into the matrix
//then print the matrix
In this code r is the no of rows in the matrix
& c is the no. of columns in the matrix. t is the one dimension array for storing elements temporarily.