We normally restrain us from using any global variables, since we want to make each module as independent from other modules as possible.
However, when you are studying programming you can use globals.
Globals have two drawbacks:
1. Any function can modify it;
2. In multi-threading programming, you don't know which thread modifies the value so that you have to use mutex, lock/unlock, etc. This complicates the situation.