title: convert int to float to hex
body: <p>Using scanf, each number typed in, i would like my program to
  print out two lines: for example</p>
  
  <pre><code>byte order: little-endian
  
  &gt; 2
       2 0x00000002
    2.00 0x40000000
  
  &gt; -2
      -2 0xFFFFFFFE
   -2.00 0xC0000000
  </code></pre>
  
  <p>I can get it to print out the 2 in hex
  but i also need a float and of course i cant scanf as one
  when i need to also scan as an int</p>
  
  <p>If i cast as a float when i try to printf i get a zero. If i scan in as a float
  i get the correct output. I have tried to convert the int to a 
  float but it still comes out as zero.</p>
  
  <p>here is my output so far</p>
  
  <pre><code>Int - float - hex
  
  byte order: little-endian
  
  &gt;2
  
           2  0x000002
        2.00  00000000
  </code></pre>
  
  <p>it looks like i am converting to a float fine
  why wont it print as a hex?
  if i scan in as a float i get the correct hex representation like the first example.
  this should be something simple. i do need to scan in as a decimal
  keep in mind
  i am running this in cygwin</p>
  
  <p>here is what i have so far..</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  
  int main(int argc, char *argv[])
  {
  
  
  int HexNumber;
      float convert;
  printf("Int - float - hex\n");
  
  
  
  int a = 0x12345678;
  unsigned char *c = (unsigned char*)(&amp;a);
  if (*c == 0x78)
  {
      printf("\nbyte order: little-endian\n");
  }
  else
  {
      printf("\nbyte order: big-endian\n");
  }
  
  printf("\n&gt;");
  scanf("%d", &amp;HexNumber);
  printf("\n%10d  ",HexNumber);
  printf("%#08x",HexNumber);
  
  
  
  
  
  convert =  (float)HexNumber; // converts but prints a zero
  
  printf("\n%10.2f  ", convert); 
  printf("%#08x", convert); // prints zeros
  
  
  return 0;
  }
  </code></pre>