Quote:
Is it true in all cases that a variable defined outside a scope and used inside a sub-scope will, after the sub-scope has been executed, retain the value that was set to it, if there was any change, in the sub-scope?
Well, technically, yes. But apparently no, because the sub scope could be function, and by default, C++ is pass-by-value. In that case you'd make a copy, edit the copy, and the changes made won't be mirrored in the calling function. You can use a reference or a pointer to fix that though.