title: Union and Struct Initialization
body: <p>I stumbled across a code based on unions in C. Here is the code:  </p>
  
  <pre><code>    union    {  
          struct  {  
              char ax[2];  
              char ab[2];  
          } s;  
          struct  {  
              int a;  
              int b;  
          } st;  
      } u ={12, 1}; 
  
      printf("%d %d", u.st.a, u.st.b);  
  </code></pre>
  
  <p>I just couldn't understand how come the output was <code>268 0</code>. How were the values initialized?
  How is the union functioning here? Shouldn't the output be <code>12 1</code>.  It would be great if anyone could explain what exactly is happening here in detail.</p>
  
  <p>I am using a 32 bit processor and on Windows 7.</p>