1.

Define a function SWAPARR() in C++ to swap (interchange) the first row elements with the last row elements, for a two dimensional integer array passed as the argument of the function.Example: If the two dimensional array contents5632124925819758After swapping of the content of 1st column and last column, it should be:9758124925815632

Answer»

void SWAPARR (int A[100][], int M, int N)

{

int Temp, I;

for (I=0;I<M;I++)

{

Temp = A[0][I];

A[0][I] = A[N-1][I];

A[N-1][I] = Temp;

}

}



Discussion

No Comment Found

Related InterviewSolutions