Local scope in switch statement - where do we break?

Possible duplicate:
break statement when using curly braces in the case of the switch

When merging a package, I came across this statement

switch (a)
{

case 1:
    {
        string str = "a is 1";
        cout << str << endl;
    }
    break;
case 2: ...
...

}

My question is, does it matter if I put the gap inside or outside the scope in case 1? here they go beyond. I tried this one and did not see any difference. It seems to me that there is no difference, but the guy with PHD from my team said that he remembers that there may be a difference, but he does not remember what it is.

+5
source share
2 answers

It makes no difference whether you put the gap inside or outside the area.

+9

A break, switch, switch. , break .

+1

All Articles