Question
Static Scope 1.3 What is the output? Make certain you show the output in the correct order. void main () { int m = 100;
Static Scope
1.3 What is the output? Make certain you show the output in the correct order.
void main()
{
int m = 100;
int i = 101;
int c = 102;
int k = 103;
int e = 104;
int y = 105;
subA();
print("main", "m=", m, "i=", i, "c=", c, "k=", k, "e=", e, "y=", y);
void subA()
{
int m = 200;
int x = 1;
subB();
print("subA", "m=", m, "i=", i, "c=", c, "k=", k, "e=", e, "y=", y);
void subB()
{
int i = 311;
int c = 312;
m += 20;
x += 5;
k += 10;
subC();
print("subB", "m=", m, "i=", i, "c=", c, "k=", k, "e=", e, "y=", y);
void subC()
{
int c = 402;
int k = 403;
int e = 404;
m += 30;
i += x;
if (x < 10)
subB();
else
subD();
print("subC", "m=", m, "i=", i, "c=", c, "k=", k, "e=", e, "y=", y);
}
}
}
void subD()
{
int y = 505;
m += 50;
i += 50;
k += 50;
e += 50;
print("subD", "m=", m, "i=", i, "c=", c, "k=", k, "e=", e, "y=", y);
}
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started