Important: The scope of an auto variable is only within the block.
If there is any locally declared variable with the same name as an outer block variable, local variable
is used and any modification is only reflected in the local variable.
But if there is no local variable with the same name, the variable from outer block is used and any modification
affects the outer block variable.
In the above program:
The variable "a" at line 5 masks the "a" from line 3. line 6 prints 10.
line 7 modifies the variable "a" declared at line 5.
line 9 also modifies "a" at declared at line 5.
line 12 prints the "a" modified at line 9 and 20 is printed.
similarly line 13 declares a new variable a=30 and increments it.
So, line 14 prints 31.
line 16 has access to the variable declared at line 5 whose current value is 20 as printed in line 12.
Finally line 18 prints the variable "a" declared at line 3 which is still 0.