home *** CD-ROM | disk | FTP | other *** search
/ Microsoft Programmer's Library 1.3 / Microsoft-Programers-Library-v1.3.iso / sampcode / qc_prog / chap07 / hexout.c < prev    next >
Encoding:
C/C++ Source or Header  |  1988-04-05  |  550 b   |  29 lines

  1. /* hexout.c --  print a floating point variable in */
  2. /*              hexadecimal format                 */
  3.  
  4. extern void Hexout();
  5.  
  6. main()
  7. {
  8.     float fary[1];
  9.  
  10.     printf("Enter a floating point number\n");
  11.     printf("(Any nonnumeric entry quits)\n\n");
  12.     while (scanf("%f", &fary[0]) == 1)
  13.         {
  14.         Hexout(fary);
  15.         }
  16.     return (0);
  17. }
  18.  
  19. void Hexout(unsigned char chary[])
  20. {
  21.     int i;
  22.  
  23.     for (i = 0; i < sizeof(float); ++i)
  24.         {
  25.         printf("%02X ", chary[i]);
  26.         }
  27.     printf("\n\n");
  28. }
  29.