Pass a dynamically allocated multidimensional array to a function : <pre><code>#include&lt;iostream&gt;

using namespace std;

void seed(int* matrixAddr, int n, int m);

void main()
{
  int n, m;
  cin &gt;&gt; n &gt;&gt; m;

  int matrix[n][m]; // DevC++ does not throw an error here, where VS does instead 

  seed(matrix, n, m);
}

void seed(int* matrixAddr, int n, int m) {}
</code></pre>

<p>Accessing <code>matrix</code> directly means referencing a memory address - in this case, to the first element of the two-dimensional array.</p>

<p>Apparently, though, the address cannot be passed as-is to the <code>seed</code> function, which accepts a pointer as its first argument. </p>

<p>Why does this happen? Should this not be allowed? </p>

<p>The error DevC++ throws is the following: <code>[Error] cannot convert 'int (*)[m]' to 'int*' for argument '1' to 'void seed(int*, int, int)'</code>  </p>
