Any one knows? | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
+ 1

Any one knows?

what is the scope rule for nested blocks?

3rd Jun 2018, 3:27 PM
sayed sayed
sayed sayed - avatar
3 Antworten
+ 6
sayed sayed Scope rule of Nested Blocks : if an identifier is declared as a variable in each of two blocks, one within the other, then these are two different variables with the same name. One variable exists only within the inner block and cannot be accessed outside the inner block. The other variable exists only in the outer block and cannot be accessed in the inner block.
3rd Jun 2018, 3:33 PM
***
+ 2
in general, automatic variables has scope of the block it is contained in
3rd Jun 2018, 3:34 PM
‎ ‏‏‎Anonymous Guy
0
The variable declared inside a scope is local to a scope .. it lasts from it's place of declaration to the end of the scope
4th Jun 2018, 7:14 AM
Aveek Bhattacharyya
Aveek Bhattacharyya - avatar