title: arrays declaration and addressing
body: <p>I have a few straightforward questions:-</p>
  
  <ol>
  <li><p>Is the following correct according to a normal c++ compiler?  </p>
  
  <pre><code>int arr[3][4];
  void func(int *a, int m, int n)
  {
   int i,j;
   cin&gt;&gt;i&gt;&gt;j; 
   cout&lt;&lt; a[i*n + j]; //is this way of addressing correct provided 0&lt;=i&lt;m and 0&lt;=j&lt;n
  } 
  
  int main()
  {
   func((int*)arr, 3,4);
  }
  </code></pre></li>
  <li><p>If the bounds of an array strictly has to be a constant expression, why doesn't the following generate compiler errors?</p>
  
  <pre><code>int func(int m, int n)
  {
   int arr[m][n]; //m and n are not known until run time
  }
  </code></pre></li>
  </ol>