# Thread: Swapping Rows and Columns in a 2D array

1. ## Swapping Rows and Columns in a 2D array

I need help with this problem

Write a program with a function called ManipulateArray. This function should accept a 2 dimensional array of size 5 by 5 and perform the following

• Initialize this array with values upon declaration
• Reverse the first column
• print the array on the screen
• Swap the contents of column 3 and column 4
• print the array on the screen
• Sort row 5 in descending order
• Sum the contents of the entire array
Your program should define a function call print, to print the array each time it is required.

this is what I have :

Code:
```#include <stdio.h>
#include <conio.h>
#include <iostream>
#include <ctype.h>

#define ROW 5
#define COL 5

void ManipulateArray (int[][]);

int main()
{
int array [ROW][COL]={ {2,4,6,8,10},{12,14,16,18,20},{22,24,26,28,30},{32,34,36,38,40},{42,44,46,48,50}};

int i,j,sum=0;

//Reverse the first column
//Print the array on the screen

//Swap the contents of column 3 and column 4
//Print the array on the screen

//Sort row 5 in descending order

//Sum the contents of the entire array

return 0;
}```

2. It appears this is an exercise in using for loops and indexing, I would like to help you but you didn't post any attempted code. If you show me you have tried the problem -- beside just creating the variables -- I would be glad you help you and correct your code (I could post a tutorial about how to use for loops or arrays but I am sure a quick google search could illustrate it way better than anything I could make).

3. Other than posting your homework, what have you actually done on your own to solve any of these problems? Because in your hurry to do your own work, you seem to have left out your own work.

Quzah.