Question: Nested Scopes and Links Consider the following pseudo - code, assuming nested subroutines and static scoping: 1 int main ( ) { 2 int x
Nested Scopes and Links
Consider the following pseudocode, assuming nested subroutines and static scoping:
int main
int x ;
int y ;
int f int b
int f int n
return n ;
b f y b ;
return b ;
int f int a
return f a ;
print f f x ;
What does the program print?
Draw a diagram of the runtime stack when function f has been called for the last
time. For each frame, show the static and dynamic links.
Refer to the runtime stack, briefly explain how function f finds variable y
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
