Consider the following datatype definitions on an x86_64 machine. typedef struct
ID: 3724765 • Letter: C
Question
Consider the following datatype definitions on an x86_64 machine.
typedef struct {
char c;
float *p;
short s;
int i;
} struct1;
Assume the alignment rules discussed in lecture: data types of x bytes in size must be aligned on x-byte boundaries (e.g., a variable of type int is 4 bytes so its address must be aligned to multiple of 4 bytes). You can assume that the compiler will not reorder the fields to reduce the total size.
Using the table below, enter the variable that would occupy the corresponding byte. For example, if byte 0 is going to be occupied by "c", simply enter "c" in that corresponding byte. If you need to insert padding to maintain correct alignment, simply enter "-" in that corresponding byte.
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23Explanation / Answer
0 c 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 p 9 p 10 p 11 p 12 p 13 p 14 p 15 p 16 s 17 s 18 - 19 - 20 i 21 i 22 i 23 i
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.