I saw a piece of code in a book, which is as follows:
x = 10;
if(x ==10) { // start new scope
int y = 20; // known only to this block
x = y * 2;
}
As per definition of Block
A block is a group of zero or more statements between balanced braces and can be used anywhere a single statement is allowed.
So
{ //block started
} //block ended
What ever the variables declared inside the block ,the scope restricted to that block.
Is that making sense ??