Question: 5. What It the output of function scoping_test when static scoping or dynamic scoping is used? (Otherwise assume C++ syntax and semantics, e.g. call by
5. What It the output of function scoping_test when static scoping or dynamic scoping is used? (Otherwise assume C++ syntax and semantics, e.g. call by value).
int n = 1; // global
plus_n (int x) {
cout << x + n;
}
increment_n ( ) {
n = n + 2;
plus_n (n);
}
scoping_test ( ) {
int n;
n = 200;
plus_n (7);
n = 50;
increment_n ( ) ;
cout << n;
}
With Static Scoping:
With Dynamic Scoping:
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
