Question: Assuming dynamic scoping is being used, what would be the output of the program below? #include using namespace std; int c = 20; void fun1(int
Assuming dynamic scoping is being used, what would be the output of the program below?
#includeusing namespace std; int c = 20; void fun1(int x) { int b = 5; x = x + c - b; c = c + 6; cout << x << " " << c << endl; } void fun2(int x) { int b = 3; int c = 4; x = x + bx = x + c - b; cout << x << " " << c << endl; fun1(x); } int main():= { int a = 8, b = 16; fun2(a) cout << x << " " << c << endl; return 0; }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
