Question: I Static and Dynamic Scoping. Consider the following program written in the C syntax int a, b, c, x, y, z; void print (int p)f

 I Static and Dynamic Scoping. Consider the following program written in

I Static and Dynamic Scoping. Consider the following program written in the C syntax int a, b, c, x, y, z; void print (int p)f if (p-0) else if (p-1) else if (p-2) printf("f: %d printf("g: %d printf("main: %d %d %d %d %d %d %d %d %d %d ", a, %d ", a, %d %d ", z); z); y, z); b, x, y, b, x, y, a, b, x, int f (int x, int y) int a = 10; b 100; c = 1000; x = g(10); int yi y = g(x); int xi x a+b ; b- g(a); print (0); z = g(0); print (0) return x*a -y* b+ z*C int g (int a) print (1) return (x y-z) *a; int main int c = 1; a = 10; x 100; y= 1000; z f(x, y); z = g(a); print (2); return 0 1) 2) What is the output of this program if static scoping is used? What is the output of this program if dynamic scoping is used

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!