Computer Science, asked by Rosanverma, 1 year ago

what is static and dynamic area? ...........................

Answers

Answered by arpi7494
0


int x; int main() { x = 14; f(); g(); } void f() { int x = 13; h(); } void g() { int x = 12; h(); } void h() { printf("%d\n",x); }

If static scoping is used, what is the result? If dynamic scoping is used, what is the result?

Now if I understand scoping right, the difference between static and dynamic scoping is that static makes variables local to a class. So the value xwould be local to void f(), void g() and int main () and dynamic would make them globally available. I'm just not sure how to apply it to this code. If static scoping was used would it only print the last value (12 from void g()) and dynamic scoping would be using all the values of x?

I'm a little confused on how scoping actually works.

Similar questions