Consider the following C declaration: struct Si (char a; int b; ) struct S2 (float a; double b; union U struct


Consider the following C declaration:
struct Si (char a; int b; )
struct S2 (float a; double b;
union U
struct S1 s1;
struct S2 s2;
}
Assume the machine has 1-byte characters, 4-byte integers, 8-byte floating numbers, and 16-byte double- precision floating numbers. Assume the compiler does not reorder the fields, and it leaves no holes in the memory layout. How many bytes does u occupy? If the memory address of u starts from 1000, what are the start addresses of u·s1.b and u . s2?


Leave a Reply

Your email address will not be published.