c++ error: invalid types int int for array subscript
<p>Trying to learn C++ and working through a simple exercise on arrays. </p>

<p>Basically, I've created a multidimensional array and I want to create a function that prints out the values.</p>

<p>The commented for-loop within Main() works fine, but when I try to turn that for-loop into a function, it doesn't work and for the life of me, I cannot see why.</p>

<pre><code>#include &lt;iostream&gt;
using namespace std;


void printArray(int theArray[], int numberOfRows, int numberOfColumns);

int main()
{

    int sally[2][3] = {{2,3,4},{8,9,10}};

    printArray(sally,2,3);

//    for(int rows = 0; rows &lt; 2; rows++){
//        for(int columns = 0; columns &lt; 3; columns++){
//            cout &lt;&lt; sally[rows][columns] &lt;&lt; " ";
//        }
//        cout &lt;&lt; endl;
//    }

}

void printArray(int theArray[], int numberOfRows, int numberOfColumns){
    for(int x = 0; x &lt; numberOfRows; x++){
        for(int y = 0; y &lt; numberOfColumns; y++){
            cout &lt;&lt; theArray[x][y] &lt;&lt; " ";
        }
        cout &lt;&lt; endl;
    }
}
</code></pre>
