Apply the two scoping methods write the values that would b

Apply the two scoping methods : write the values that would be printed if this pseudo-code program were statically scoped - dynamically scoped.

program A is

int x;

procedure B is

begin -- B

x = 5;

print(x);

end B;

procedure C is

int x;

begin -- C

x = 3;

B;

print(x);

end C;

begin -- A

x = 1;

C;

print(x) ;

end A;

Solution

when the program is run using static scoping x=1

and when run using dynamic scoping x=5

Apply the two scoping methods : write the values that would be printed if this pseudo-code program were statically scoped - dynamically scoped. program A is int

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site