1. Evaluate C Expressions (30 points/2 point each). Use the following macro defi
ID: 3857646 • Letter: 1
Question
1. Evaluate C Expressions (30 points/2 point each). Use the following macro definitions and variable declarations to statements. evaluate the following expressions or Also, assume that char, int, and pointers are the same size and both take up one location in LC-3 memory . Also, assume the expressions are evaluated independently without updates. . In the case of arrays and structs, the initial values should be interpreted with the same meaning as C array initializers. . In the case of structs, assume that fields of a struct occupy adjacent locations in memory. The base address of a struct is the location of the first field. Consider these struct definitions typedef int Number struct list Number data; struct list * next; typedef struct list List; typedef struct [ int a; char b: Number c: Stuff:Explanation / Answer
Expression (Type)value array 0x700b(base address of array) l1 0x7000(base address of l1) &l1 0x7000(base address of l1) l1.next 0x7002(address part of struct l1) p1->next 0x7002(value at 7008) p2->next 0x7006(value at 7009) &(l1.next->next) 0x7004 sizeof(array[0]) 3 bytes(sizeof a,b and c) sizeof(List) 2 bytes(sizeof data and *next) sizeof(List*) 1 byte array[2].a 6(3rd row ,first element) &(array[1].c) 0x7010(address of 5) l3.data 3 p1->next>next>data 3
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.