title: Convert ieee 754 float to hex with c - printf
body: <p>Ideally the following code would take a float in IEEE 754 representation and convert it into hexadecimal  </p>
  
  <pre><code>void convert() //gets the float input from user and turns it into hexadecimal
  {
      float f;
      printf("Enter float: ");
      scanf("%f", &amp;f);
      printf("hex is %x", f);
  }
  </code></pre>
  
  <p>I'm not too sure what's going wrong. It's converting the number into a hexadecimal number, but a very wrong one. </p>
  
  <pre><code>123.1443 gives 40000000
  43.3     gives 60000000
  8        gives 0
  </code></pre>
  
  <p>so it's doing something, I'm just not too sure what.</p>
  
  <p>Help would be appreciated</p>