title: How to print out each bit of a floating point number?
body: <p>I am trying to print out each bit of a floating point number in C.</p>
  
  <p>I am able to do it for integers with this:</p>
  
  <pre><code>int bit_return(int a, int loc)
  
  // Bit returned at location
  {
    int buf = a &amp; 1&lt;&lt;loc;
  
    if (buf == 0)
      return 0;
    else
      return 1;
  }
  </code></pre>
  
  <p>The compiler wouldn't compile if I replaced <code>int a</code> with <code>float a</code>.</p>
  
  <p>Is there a solution for this?</p>
  
  <hr>
  
  <p><em>Copy and reformat your comment below</em></p>
  
  <p>OK, for people who are not clear, I post my whole code here:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  
  int bit_return(int a, int loc) // Bit returned at location
  {
    int buf = a &amp; 1&lt;&lt;loc;
    if (buf == 0)
      return 0;
    else
      return 1;
  }
  
  int main()
  {
    int a = 289642; // Represent 'a' in binary
    int i = 0;
    for (i = 31; i&gt;=0; i--)
    {
      printf("%d",bit_return(a,i));
    }
    return 0;
  }
  </code></pre>