title: Static Matrix Casting to a pointer
body: <p>I have matrix M:</p>
  
  <pre><code>float M[4][3] = {
      0, 0, 0,
      0, 1, 1,
      1, 0, 1,
      1, 1, 0};
  </code></pre>
  
  <p>And I need to cast M with the purpose of use the method "foo":</p>
  
  <pre><code>foo(float **matrix){ 
      printf("%f",matrix[0][0]);
  }
  </code></pre>
  
  <p>I compiled sucessfully the code using:</p>
  
  <pre><code>foo( (float**) M )
  </code></pre>
  
  <p>But when I executed it, I got a segment fault. What is wrong? I am using g++ in Ubuntu Oneiric.</p>
  
  <p>Thanks in advance.</p>
  
  <hr>
  
  <p>Ok, thanks Luchian, but what about using:</p>
  
  <pre><code>float **M = new float*[4];
  M[0] = {0,0,0};
  </code></pre>
  
  <p>I know that it does not compile, but there it something similar?</p>