Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

Hiding Names

You can hide a name by declaring it in an enclosed block. In the following figure, i is redeclared within the inner block, thereby hiding the variable associated with i in the outer block scope.

Block Scope and Name Hiding

Block Scope Name Hiding

The output from the program shown in the figure is:

i = 0
i = 7
j = 9
i = 0
NoteNote

The argument szWhat is considered to be in the scope of the function. Therefore, it is treated as if it had been declared in the outermost block of the function.

Reference

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.