Local Scope

A name has local scope if it is declared in a block. A name with local scope can be used in that block and in blocks enclosed within that block, but the name must be declared before it is used. When the block is exited, the names declared in the block are no longer available.

Formal argument names for a function have the scope of the outermost block of that function.

If a local variable is a class object with a destructor, the destructor is called when control passes out of the block in which the class object was constructed.

When one block is nested inside another, the variables from the outer block are usually visible in the nested block. However, if an outer block variable is redefined in a nested block, the new declaration is in effect in the inner block. The original declaration is restored when program control returns to the outer block. This is called block visibility.



Destructor
Statement Blocks