My teacher has provided the following pseudo-code, and says that the output using static scope is 1 2 3
, but the output using dynamic scope is 2 3 4
.
void fun1(void);
void fun2(void);
int a = 1, b = 2, c = 3;
int main() {
c = 4;
fun1();
return 0;
}
void fun1() {
int a = 2, b = 3;
fun2();
}
void fun2(){
printf("%d %d %d", a, b, c);
}
Which variable we use in Static Scope? $c=3$ or $c=4$? (by Static Scope Rule and without considering C Rules).