+ 1
What Different And Function Between Global And Local Variable C++
iam not undertestand for what is global variable. someone can explain with simple answer ?.
3 Respostas
+ 10
Most variables have a limited scope in which they are accessible (within the function where they are declared, but not in functions that call or are called by that function).
A global variable is declared outside of any function, and is accessible to any part of the program. Typically they will be declared just after the #include statements.
That can make some things easier to write, but global variables can make for debugging headaches if you are not very careful with them. Personally, I avoid them whenever possible.
Did that help?
+ 9
Glad to have helped!
+ 2
iam undertestand now :D thanks jim