Question: Consider the following C declaration: union U1 {float romo; double posey;}; union U2 {char cain; int posey;}; struct S { union U1 sf; union U2

Consider the following C declaration:

union U1 {float romo; double posey;}; union U2 {char cain; int posey;}; struct S { union U1 sf; union U2 giants; } s;

Assume that the machine has 1-byte characters, 4-byte integers, 8-byte floating numbers, and 16-bytedouble-precision floating numbers. Assume the compiler does not reorder the fields, and it leaves no holesin the memory layout.

a) (4pt) How many bytes does occupy?

b) If the memory address of s starts from 1000, what are the start addresses of s.u1.bands.u2.b?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!