For the picture below draw the final picture of the stack an

For the picture below, draw the final picture of the stack and static segments after execution of the following command sequence: push static 3 push static 0 add pop static 1

Solution

Stack

static

Push static 3 will push the value in static memory segment at address 3 ie -532 to the stack at the stack pointer and the stack pointer is incremented.

Push static 0 will push the value 5 at address 0 in static memory segment at the stack pointer.

Add will apply add operation on the two top elements of the stack , -532+5 = -527 and push -527 on stack

Pop static 1 will pop the top element ie -527 and assign it to memory address 1 in static segment

121
5
17
-532
5
 For the picture below, draw the final picture of the stack and static segments after execution of the following command sequence: push static 3 push static 0 a

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site