+ 5

[Solved] What is local variables?

maybe i am stupid but idk

3rd Feb 2018, 2:13 PM
Фид
Фид - avatar
3 Answers
+ 11
In computer science, a local variable is a variable that is given local scope. Local variable references in the function or block in which it is declared override the same variable name in the larger scope.
3rd Feb 2018, 2:20 PM
Scooby
Scooby - avatar
+ 5
A global variable is declared outside any function, including main. A global variable can be accessed from anywhere in the program. A local variable is declared inside a function or block of code. It can only be accessed inside that block. Local variables take precedence over global variables. Here there is a c++ code which may help to better understand. https://code.sololearn.com/c2CP8lP3wgb0/?ref=app Best of luck!
3rd Feb 2018, 3:57 PM
Red Hawks
Red Hawks - avatar
+ 2
Thanks
4th Feb 2018, 11:18 AM
Фид
Фид - avatar