Code:
// wrong
if (1)
{
    int i = 3;
}
cout << i; // variable not defined in this scope

// correct
int i;
if (1)
{
    i = 3;
}
cout << i; // variable is defined in scope