title: What is printf's behaviour when printing an int as float?
body: <p>I am using dev cpp on windows7 to compile my code.</p>
  
  <pre><code>int d = 0x12;
  char* e = (char*)&amp;d;
  printf("%d %d\n", sizeof (int), sizeof (float));
  printf("%p %p\n", &amp;d, (float*)&amp;d);
  printf("%p %p %p %p %p\n", &amp;d, &amp;e[0], &amp;e[1], &amp;e[2], &amp;e[3]);
  printf(" %d | %x | %#1x | %#1x | %#1x |%p\n", d,  e[0], e[1], e[2], e[3], &amp;e[0]);
  getchar();
  
  4 4 
  0028FF40 0028FF40
  0028FF40 0028FF40 0028FF41 0028FF42 0028FF43  
  18 | 12 | 0 | 0 | 0 |0028FF40
  </code></pre>
  
  <p>You  an see that if I use %d for printing d, it is printing the 4 bytes of e fine. But if I use %f like below, it shows  zeros in the place where the first byte of e have to be printed. Anyone can help with why this happens? Why should e's contents depend on how d is formatted?</p>
  
  <pre><code>int d = 0x12;
  char* e = (char*)&amp;d;
  printf("%d %d\n", sizeof (int), sizeof (float));
  printf("%p %p\n", &amp;d, (float*)&amp;d);
  printf("%p %p %p %p %p\n", &amp;d, &amp;e[0], &amp;e[1], &amp;e[2], &amp;e[3]);
  printf(" %f | %x | %#1x | %#1x | %#1x |%p\n", d,  e[0], e[1], e[2], e[3], &amp;e[0]);
  getchar();
  </code></pre>
  
  <p>The output is:</p>
  
  <pre><code>4 4
  0028FF40 0028FF40
  0028FF40 0028FF40 0028FF41 0028FF42 0028FF43
   0.000000 | 0 | 0 | 0 | 0x28ff40 |76869F1D
  </code></pre>