Challenge 2: Writing an int Member and Reading Back a float Member — Possible Solution ==================================================================== #include union Value { int as_int; float as_float; }; int main() { union Value v; v.as_int = 100; printf("as_int: %d\n", v.as_int); printf("as_float: %f\n", v.as_float); return 0; } Typical output (not a meaningful conversion of 100): as_int: 100 as_float: 0.000000 (The exact float value shown may differ by platform/compiler -- it is whatever the raw bit pattern of the integer 100 happens to represent when reinterpreted as an IEEE-754 float, not a rounding or type conversion of the number 100.) Explanation: as_int and as_float occupy the EXACT SAME memory, per the chapter's own definition of how a union works. Writing 100 into as_int stores the integer 100's raw bit pattern into that shared memory. Reading as_float afterward doesn't convert that value to a float the way an explicit cast (float)100 would (which WOULD produce 100.0) -- it instead reinterprets the SAME raw bits as if they were a float's own bit layout, which is a completely different, essentially unrelated value, since an int's bit representation and a float's bit representation encode numbers in entirely different formats. WHY THIS WORKS AS AN ANSWER ------------------------------ This correctly predicts that as_float will NOT show anything related to 100 or 100.0, and explains precisely why: shared memory means reading the "wrong" member reinterprets the same raw bits under a different type's encoding rules, rather than performing any kind of numeric conversion.