Although the example below compiles fine except for the last line with the error, I'd like to know the ins and outs of this 'scoping' within a scope? Also the terminology of this, if any.
Consider these brackets:
void func()
{
    int i = 0;
    { // nice comment to describe this scope
        while( i < 10 )
            ++i;
    }
    { // nice comment to describe this scope
        int j= 0;
        while( j< 10 )
            ++j;
    }
    i = 0; // OK
    // j = 0; // error C2065
}
consider this:
error C2065: 'j' : undeclared identifier
edit: Accepted answer is from bitmask, although I think everyone should place it in the context of anio's answer. Especially, quote: "perhaps you should break your function into 2 functions"