I've been trying to write a program which takes a list of numbers, entered by the user, which are stored in a 2-dimensional array (like a matrix). The program prints it out in matrix form, then uses a function to transpose the array, and then the transposed array is printed.
Here is the program:
#include <iostream>
using namespace std;
void transpose(int length, int width, int input[][length], int output[][width])
{
    for(int j=0; j<length; j++)
        for(int i=0; i<width; i++)
        {
            output[j][i]=input[i][j];
        }
}
int main()
{
    int width;
    int length;
    cout << "enter the width followed by the length of the matrix: ";
    cin >> width >> length;
    int input[width][length];
    int output[length][width];
    cout << "enter elements \n";
    for(int j=0; j<length; j++)
        for(int i=0; i<width; i++)
        {
            cin >> input[i][j];
        }
    cout << "your matrix is: \n";
    for(int j=0; j<length; j++)  //output in matrix form
        for(int i=0; i<width; i++)
        {
            cout << input[i][j] << " ";
            if(i==width-1)
                cout << endl;
        }
    /*for(int j=0; j<length; j++)     //to check if transpose works
     for(int i=0; i<width; i++)
     {
     output[j][i]=input[i][j];
     }*/
    transpose(length, width, input, output);
    cout << "the transpose is: \n";
    for(int j=0; j<width; j++)
        for(int i=0; i<length; i++)
        {
            cout << output[i][j] << " ";
            if(i==length-1)
                cout << endl;
        }
    return 0;
}
When I try to call the function in main, it gives the error: "No matching function for call to 'transpose'" and then says "Candidate function not viable: no known conversion from 'int [width][length]' to 'int (*)[length]' for 3rd argument". I don't understand why. I've tried searching but I've had no luck (although it's entirely possible I didn't understand the solutions, or I was searching for the wrong thing).
In case it's relevant, I'm on a Mac using Xcode.
 
     
    