When is it ok to use a global variable in C?
Variables should always have a smaller scope possible. The argument behind that is that every time you increase the scope, you have more code that potentially modifies the variable, thus more complexity is induced in the solution. It is thus clear that avoiding using global variables is preferred if the design and implementation naturally allow … Read more