Endianess using %d specifier for float : <pre><code>void main()
{
  float a=2;
  printf("%d",a);
}
</code></pre>

<p>In my machine, float is 4 bytes, int is 2 bytes and bytes are stored in little-endian format.</p>

<p>a is 0x 00 00 00 02</p>

<p>Now as my machine is little endian, the bytes should be stored as 0x 02 00 00 00</p>

<p>Now when I use %d specifer, first 2 bytes should be fetched and output should be 512, but I am not getting that output.</p>

<p>Can someone tell me why is it happening?</p>
