are global variables bad in c?
Why should we avoid using global variables in C/C++? 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. It can not be limited to some parts of the program.