0
What do we mean by variable lifetime?
it has to do with local and global variables. please help
2 ответов
+ 4
In programming language a variable stores data and have a place in memory (depending on the language it's just point to that place). When you declare that variable in a specific block of code it becomes a local variable and it's only valid there. Other blocks 'cannot see' that place in the memory. But when you declare a variable out of all blocks of code (out of indented or curly braces or whatever) it becomes a global variable and can be accessed wherever you require.
Hope it helps.
0
@Henrique best answer