Consider the following skeletal C program: void funl (void)i* prototype / void f
ID: 3708667 • Letter: C
Question
Consider the following skeletal C program: void funl (void)i* prototype / void fun2 (void)iprototype/ void fun3 (void)iprototype/ void main) int a, b, c; void funl (void) t int b, c, d; void fun2 (void) t int c, d, e; void fun3 (void) t int d, e, Given the following calling sequences and assuming that dynamic scoping is used, what variables are visible during execution of the last function called? Include with each visible variable the name of the function in which it was defined a. main calls fun1; funl calls fun2; fun2 calls fun3 b. main calls fun1; fun1 calls fun3 c. main calls fun2; fun2 calls fun3; fun3 calls fun1 d. main calls fun3; fun3 calls fun1 e. main calls funl; funl calls fun3; fun3 calls fun2 f. main calls fun3; fun3 calls fun2; fun2 calls fun1Explanation / Answer
Using this scoping rule, we first look for a local definition of a variable. If it isn't found, we look up the calling stack for a definition.
a) visible variables are : d,e,f from fun3
c from fun2
b from fun1
a from main
b) d,e,f from fun3
b,c from fun1
a from main
c) b,c,d from fun1
e,f from fun3
c from fun2
a from main
d) b,c,d from fun1
e,f from fun3
a from main
e) c,d,e form fun2
f from fun3
b form fun1
a from main
f) b,c,d from fun1
e from fun2
f from fun3
a from main
hit thumbs up if you like the answer.please