(10 points) Expression Evaluation. Evaluate the following expressions assuming 3
ID: 3737906 • Letter: #
Question
(10 points) Expression Evaluation. Evaluate the following expressions assuming 32 bit integers and 32 bit pointers. Variables are declared as listed but after some unknown number of operations the current state of the memory is given by the supplied memory diagram. struct node int data; struct node other; typedef struct node Node; Node v Node* p Variable Name/Memory Address Value 8000 2 8004 8016 8008 9004 8012 9028 8016 9032 8020 9020 9000 3 9004 9016 9008 9012 100 9016 87 9020 9008 9024?101 9028 1 9032 9000 9036 9016 v.other (v.other->data) + 1; (p->other->data) other->other->other->otherExplanation / Answer
1)
v.other; = 8016
2)
(v.other->data)+1; = 9033
3)
(p->other->data) << v.data;
(p->other->data) = 9000
v.data = 2
Therefore,
(p->other->data) << v.data; = 9000 << 2 = 2250
4)
p->other[3].data; = 5
5)
p->other->other->other->other; =
p->other = 9032
p->other->other = 9016
p->other->other->other = 9008
p->other->other->other->other = 100
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.