Consider the following program fragment in Pascal:
Program Main; var X : integer; procedure A: var Y : integer; procedure B: var Z : integer; procedure C: var Z : integer; begin(*Procedure C*) . . end(*Procedure C*) begin(*Procedure B*) . . C; (*call to C*) A; (*call to A*) . . end(*Procedure B*) begin(*Procedure A*) . . B; (*call to B*) . . end(*Procedure A*) begin (*Main*)
Assume that there are no calls to any procedures other than the ones indicated above. It is known that at some point of time during the execution of this program five activation records exist on the run-time stack. Describe the run-time stack at this point of time by clearly indicating the following: the top of the stack, the contents of the static link and dynamic link, and allocation of the local variables in each record.
Quiz of this Question
Please comment below if you find anything wrong in the above post