3.70 Union
★★★
Last updated
★★★
Last updated
Consider the following union declaration:
This declaration illustrates that structures can be embedded within unions.
The following function (with some expressions ommitted) operates on a linked list having these unions as list elements:
A. What are the offsets (in bytes) of the following fields?
B. How many total bytes does the structure require?
16 bytes.
C. The compiler generates the following assembly code for proc
:
On the basis of this information, fill in the missing expressions in the code for proc
. Hint: Some union references can have ambiguous interpretations. These ambiguities get resolved as you see where the references lead. There is only one answer that does not perform any casting and does not violate any type constraints.
field
offset
e1.p
0
e1.y
8
e2.x
0
e2.next
8