Question: Consider the following program which is written in C syntax: int x = 1 ; void f 1 ( ) { int x = 2

Consider the following program which is written in C syntax: int x =1; void f1(){ int x =2; f2(); printf(x)} void f2(){ int x =3; printf(x)} int main(){ f1(); printf(x) H (a) What will be printed after running main() when it uses static scoping? (b) dynamic scoping?

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!