Question: int a = 0 ; 2 int b = 0 ; 3 void print ( ) { 4 printf ( % d , %

int a =0;
2 int b =0;
3 void print (){
4 printf ("%d ,% d ", a , b );
5}
6
7 int fun1(){
8 int a , c ;
9 a =1; b =2; c =3;
10 print ()
11 return c ;
12}
13
14 void fun2( int c ){
15 int a ;
16 a =9; b = c ;
17 print ();
18}
19
20 int main (){
21 a = fun1();
22 fun2(8);
23 print ();
24 return 0;
25}
1. Draw the symbol tables in separation for all 5 scopes in this program. Assume each
table contains two columns: name and type.
2. What is the output of the above code with static scoping? Justify your answer by
showing the tree of the symbol tables.
3. What is the output of the above code with dynamic scoping? Justify your answer by
showing the tree of the symbol tables1 d

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!