title: How does ' %f ' work in C?
body: <p>Hey i need to know how %f works , that is how</p>
  
  <pre><code>printf("%f",number);
  </code></pre>
  
  <p>extract a floating point number from a series of bits in number.
  Consider the code:</p>
  
  <pre><code> main()
  {
  int i=1;
  printf("\nd  %d\nf %f",i,i);
  }
  </code></pre>
  
  <p>Output is :</p>
  
  <p>d  1</p>
  
  <p>f -0.000000</p>
  
  <p>So ultimately it doesn't depend on variable 'i', but just depends on the usage of %d and %f(or whatever) i just need to know how %f extracts the float number corresponding to series of bits in 'i'</p>
  
  <p>To all those who misunderstood my question i know that %f can't be used to an integer and would load garbage values if size of integer was smaller than float. As for my case the size of integer and float are 4 bytes.  </p>
  
  <p>Let me be clear if value of is 1 then the corresponding binary value of i will be this:</p>
  
  <pre><code>0000 0000 0000 0000 0000 0000 0000 0001 [32 bits]
  </code></pre>
  
  <p>How would %f extract -0.0000 as in this case from this series of bits.(How it knows where to put decimal point etc , i can't find it from IEEE 754)</p>
  
  <p>[PLEASE DO CORRECT ME IF I AM WRONG IN MY EXPLANATION OR ASSUMPION]</p>