title: Allocating a specific two deminsional array, very simple
body: <p>I have a very basic question regarding arrays in C.
  i have this struct:     </p>
  
  <pre><code>struct Matrix{   
  int rows;
  int cols;
  int** matrix;
  };
  </code></pre>
  
  <p>and when i tried to use this struct and to declare a Matrix, i have come across this problem         </p>
  
  <pre><code>Matrix matrix;           
  matrix-&gt;matrix = (int**) malloc(3*sizeof(int*));//allocates pointer to a pointers array
  
  for (int i = 0; i &lt;3; i++){
  
      matrix-&gt;matrix[i] = (int*) malloc(3*sizeof(int));
  }//allocating a 3X3 array
  
  matrix-&gt;matrix={1,2,3,4,5,6,7,8,9};
  </code></pre>
  
  <p>however that last line won't work, apparently because the compiler doesn't understand the size of my array.    </p>
  
  <p>even when I try to do it this way:    </p>
  
  <pre><code>matrix-&gt;matrix={{1,2,3},{4,5,6},{7,8,9}};
  </code></pre>
  
  <p>does anyone know how to do this ? it seems to me like something very simple.
  thanks a lot!</p>