Pointers for Arrays

I’m trying to call an array from main() into a function and transpose it in c++. I have the code written, but in c++ you can’t return multiple values from functions without using pointers. I’ve tried looking into it myself online but with no progress. My guess is I can’t comprehend the idea behind it. Can one of you guys break it down for me. I’m going to post the code and show what progress I’ve made so far. It’s still not complete as I have to add logic tests and such. I was mainly trying to get the hardest part of the code finished first.

[code=cpp]/*
*Zach Marshall
*3/31/2016
*For MATLAB Dr. Ross
*
*
*Description:
*Develop a program that will take the dimmensions of 2 seperate arrays and multiply them together.
*The Dimmensions must match as following: The Columns of the First, and the Rows of the Second.
*We will be writing this code in C++ and then converting to a MATLAB Script
*/

/* WHAT WILL WE NEED:
Functions: Size – Checks the size of the arrays and makes sure that the corresponding rows and columns match up
Functions: Multiplicaton – This function will actually do the multiplication
Orientations:
[X,Y] * [Y,X]
[Y,X] * [X,Y]
[X,Y] * [X,Y]’ – The ’ is a transpose in MATLAB and will flip the array.
[X,Y]’ * [X,Y]


*/

#include
using namespace std;

const int rowA = 4, rowB = 5;
const int colA = 5, colB = 4;

int* Transpose(int ArrayA[rowA][colA], int* ArrayB[rowB][colB]); //pass both lengths and widths

int main()
{

//declare variables


//setup arrays
int ArrayA[rowA][colA] = { {1, 2, 3, 4, 5}, {6, 7, 8, 9, 10}, {11, 12, 13, 14, 15}, {16, 17, 18, 19, 20} };

int ArrayB[rowB][colB];

for (int i = 0; i < 5; i++)
{
	for (int j = 0; j < 4; j++)
	{
		cout << ArrayB[i][j] << "\t";

	}
	cout << endl;
}

ArrayB[rowB][colB] = *Transpose(ArrayA[4][5], ArrayB(5)[4]);

}

int* Transpose(int ArrayA[rowA][colA], int *ArrayB[rowB][colB]) //pass both lengths and widths
{
//this loop transposes ArrayA into ArrayB
//Swaps the dimmensions of ArrayB to match ArrayA
for (int i = 0; i < 4; i++)
{
for (int j = 0; j < 5; j++)
{
*ArrayB[j][i] = ArrayA[i][j];
}
}
return ArrayB[colB][rowB];
}[/code]

I’m not asking for you to re-write the code for me, I would never want that. But some of you are probably capable of teaching introductory classes on this type of programming. I looked into JustAGuy’s meta-template programming but it was a bit over my head as well.

you can't return multiple values from functions without using pointers.

Not really.