Chapter 6: Runtime System

Example

For the example in the slide, the scope of declaration of b in B0 does not include B1 because b is re-declared in B1. We assume that variables are declared before the first statement in which they are accessed. The scope of the variables will be as follows:

Declaration Scope
int a=0 B0 not including B2
int b=0 B0 not including B1
int b=1 B1 not including B3
int a =2 B2 only
int b =3 B3 only
The outcome of the print statement will be, therefore:

2 1

0 3

0 1

0 0