Some Variable are outside the classes in C++ are knows as Global variable.
Some features of Global Scope.
Initialized of Global variable is 0.
Global Variable are not passed as parameters.
The memory for global variables will be allocated before the execution of function main().
Q.) Example of Global Variables in C++ .
#include < iostream>
using namespace std;
int g = 10;
void func1(){
g = 20;
cout << g << endl;
}
int main(){
func1();
g = 30;
cout << g << endl;
return 0;