+ 5
[Solved] What is local variables?
maybe i am stupid but idk
3 Réponses
+ 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.
+ 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!
+ 2
Thanks