/* * Program to display internal representation of floating-point number. */ #include #include typedef union { float f; int i; } float_or_int; int main(void) { float_or_int f; printf("enter a floating-point number:\n"); if (scanf("%f", &f.f) != 1) { printf("error -- not numeric\n"); return EXIT_FAILURE; } printf("%g is represented as %x\n", f.f, f.i); return EXIT_SUCCESS; }