title: C++ Dynamic/Static arrays as parameters to functions
body: <p>I have been trying to use 2D array as a parameter to a constructor in my C++ class.</p>
  
  <p>Header:</p>
  
  <pre><code>Matrix::Matrix(double **initComponents, int rows, int columns)
  </code></pre>
  
  <p>If I just go ahead and do regular calls to new and initialize sub arrays, pass a pointer to a constructor, its all good BUT I was thinking , can I just create static 2D array with initializer and pass a pointer to it, to a constructor?</p>
  
  <pre><code>double A[][3] = { {2.0, 3.0, 4.0} , {1.0, 3.0, 4.0} , {2.0, 3.0, 4.0} }; 
  Matrix *mtx = new Matrix(A, 3, 3);
  </code></pre>
  
  <p>that does not work :(</p>
  
  <p>MS Visual Studio compiler :</p>
  
  <pre><code>" error C2664: 'Matrix::Matrix(double **,int,int)' : cannot convert parameter 1 from 'double [3][3]' to 'double ** "
  </code></pre>
  
  <p>Can anyone explain why? I thought it will do an automatic conversion between reference and a pointer. </p>
  
  <p>Second question is, why can I just declare <code>A</code> as double <code>A[][]</code>, why do I have to specify the second dimension, even though I specify all values.</p>