title: Cast an array to a struct and vice-versa in c
body: <p>Let be the following struct:</p>
  
  <pre><code>typedef struct { 
      int x;
      int y;
  } st;
  </code></pre>
  
  <p>I can "cast" an int array to a struct st:</p>
  
  <pre><code>st z;
  int t[2];
  t[0] = 0;
  t[1] = 1;
  z = *(st*)(t);
  printf("%d,%d\n", z.x, z.y);
  </code></pre>
  
  <p>Then the output is, as excepted: </p>
  
  <pre><code>0,1
  </code></pre>
  
  <p>But i cant cast a struct st to an int array:</p>
  
  <pre><code>st z = {0, 1};
  int t[2];
  t = *(int*)(&amp;z);
  </code></pre>
  
  <p>since an array cant be assigned after initialization.</p>
  
  <p>So, how may i achieve this ?
  Thanks for helping me.</p>