Exercise 1.6.1 : For the block-structured C code of Fig. 1.13(a), indicate the
values assigned to w, x, y, and z.
Ans.w = 13, x = 11, y = 13, z = 11
Exercise 1.6.2 : Repeat Exercise 1.6.1 for the code of Fig. 1.13(b).
Ans.w = 9, x = 7, y = 13, z = 11
Exercise 1.6.3 : For the block-structured code of Fig. 1.14, assuming the usual
static scoping of declarations, give the scope for each of the twelve declarations.
Ans.-----------------------------------------------------
declaration variable scope
-----------------------------------------------------
int w, x, y, z; w B1 - B3 - B4
x B1 - B2 - B4
y B1 - B5
z B1 - B2 - B5
int x, z; x B2 - B3
z B2
int w, x; w B3
x B3
int w, x; w B4
x B4
int y, z; y B5
z B5
-----------------------------------------------------
Exercise 1.6.4 : What is printed by the following C code?
Ans. 3
2