Program A()
{
x, y, z: integer;
procedure B()
{
y: integer;
y=0;
x=z+1;
z=y+2;
}
procedure C()
{
z:
Static scoping and Dynamic scoping are different ways to find a particular variable with a specific unique name in a program written in any language.
Its specifically helpful for interpreter or compiler to decide on where and how to find the variable.
Consider code is like below,
f2(){
f1(){
}
f3(){
f1()
}
}
This is basically textual, first variable is defined or not will be checked in local function(lets name it f1()), if not in the local function f1(), then variable will be searched in function f2() that enclosed this function(by this I mean f1()), ...this continues...until variable is found.
This is different from static, in the sense, as it is more runtime or dynamic, first variable is defined or not will be checked in local function,if not in the local function f1(),then variable will be searched in function f3() that called this function(by this I mean f1() again), ...this continues...until variable is found.