Question: why global variables are bad?
Answer: Global variables can be altered by any part of the code, making it difficult to remember or reason about every possible use. A global variable can have no access control. ... Using global variables causes very tight coupling of code. Using global variables causes namespace pollution.