InterviewSolution
Saved Bookmarks
| 1. |
Define a function SWAPCOL() in C++ to swap (interchange) the first column elements with the last column elements, for a two dimensional integer array passed as the argument of the function. Example: If the two dimensional array contents2149137758637212After swapping of the content of 1st column and last column, it should be: 9142737138652217 |
|
Answer» void SWAPCOL(int A[ ][100], int M, int N) { int Temp, I; for (I=0;I<M;I++) { Temp = A[I][0]; A[I][0] = A[I][N-1]; A[I][N-1] = Temp; } } |
|