Question: State where you use dynamic scoping and why you use it here. If you need to implement it using static scoping instead of dynamic scoping,
State where you use dynamic scoping and why you use it here. If you need to implement it using static scoping instead of dynamic scoping, what will you do? You do not need to implement it, just describe your idea clearly. Now try to summarize your understanding about dynamic scoping.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | int b = 5; int foo() { int a = b + 5; return a; }
int bar() { int b = 2; return foo(); }
int main() { foo(); // returns 10 bar(); // returns 7 return 0; }
|
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
