Nesting Scope, Example 1
•
{
•
int x = 0;
•
{
•
int y = 0;
•
// x exists, y exits, z does not yet exist
•
}
•
{
•
int z = 0;
•
// x exists, y destroyed, z exists
•
}
•
// x exists, y destroyed, z destroyed
•
}
•
This code is fine because the variable y exists until the matching brace, which is at the end of the program after the cout << y << endl;