int i ;
program main ()
{
i = 10;
call f();
}
procedure f()
{
i = 20;
call g ();
}
procedure g ()
{
print i;
}
What will be the output using Static Scoping and Dynamic Scoping ?
My ans :
In Static Scoping Global variable is set by main firstly,now global i=10
upon calling f , it sets the Global variable i to 20.
Calling g ---> output is 20.
Dynamic Scoping output is also 20 .
Can someone check this ?