(7) (4 points) Considering the following C program void fun1(void) int a, b, c;
ID: 3589988 • Letter: #
Question
(7) (4 points) Considering the following C program void fun1(void) int a, b, c; /*definition 1 void fun2(void) ( int a,c; /*definition 2*/ void fun3 (void) ( int a; /*definition 3*/ point X: use a, use c; when we have calling sequence fun 1(/> fun2()fun30, at point x, (1) According to static scoping, for "use a", a is the one defined in 2) According to static scoping, for "use c", c is the one defined in (3) According to dynamic scoping, for "use a", a is the one defined in (4) According to dynamic scoping, for "use c", c is the one defined inExplanation / Answer
1) a is the one defined in fun3()
In case if local variable is present it is given preference in both static scoping and dynamic scoping both.
2) c is the one defined in the global area or which is the global variable and is declared outside main
3) a is the one defined in fun3()
In case if local variable is present it is given preference in both static scoping and dynamic scoping both.
4) c is the one defined in fun2()
In dynamic scoping previously called function is searched for unknown variable
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.