title: How the char array in union is working?
body: <pre><code>static int i = 2;
  union U {
    int a, b;
    char c[3];
  }u;
  
  
   int main(){
     u.b = 0x6;
     for(;i; u.b++)
      u.b = u.a &lt;&lt; i--;
    printf("%d %o %s", u.a, u.b, u.c);
   return 0;
  }
  </code></pre>
  
  <p>This code gives the output for the character array as 3. Now I know that this code poses several <code>Undefined Behaviour</code> specially when I am a storing into one variable and accessing of some other, but just for the purpose of experiment, can anybody explain to me why <code>u.c</code> has a value of <code>3</code>.</p>
  
  <p><strong>Note: Internal memory structure would be better to understand this</strong> </p>