title: How to assign a multi-dimensional array to a temporary variable?
body: <p>I want to assign a statically allocated, multi-dimensional array to a temporary variable. Consider the following example:</p>
  
  <pre><code>void foo(int b[3][2])
  {
      b[1][1] = 1; // no segmentation fault
  }
  
  int main()
  {
      int a[3][2] = {{1, 2}, {11, 12}, {21, 22}};
  
      foo(a);
  
      int** c;
      c = (int**)&amp;a;
      c[1][1] = 1; // segmentation fault on execution
  
      int* d[3];
      d[0] = (int*)&amp;(a[0]);
      d[1] = (int*)&amp;(a[1]);
      d[2] = (int*)&amp;(a[2]);
      d[1][1] = 1; // no segmentation fault
  
      return 0;
  }
  </code></pre>
  
  <p>Basically I want to do what the compiler does with the parameter <code>b</code> of <code>foo()</code>. But the only working solution I could come up with is <code>d</code>. Is there no less complicated way?</p>