c++ how to use global variables code example
Example: c++ global variable
// a.cpp
int x = 5;
// b.cpp
extern int x; // allows b.cpp to access 'x' from a.cpp
// a.cpp
int x = 5;
// b.cpp
extern int x; // allows b.cpp to access 'x' from a.cpp