If we declare variable inside for() what is the scope of it according to the last standard of the C++?
Code:int main() { int i; //is it in the same skop as i1? for(int i1 = 5; i;--i) { int i2; //is this 3rd skop? it is possible to declare local int i1 here? //... } //is i1 visible here? }



LinkBack URL
About LinkBacks



, common sense tells me that this cannot be so. If it were so, you shouldn't be able to declare any names inside a loop (its curly brackets). If that variable didn't go out of scope at the end of the iteration, I can't see how that would be different from