Chapter 3: Problem 19
Give one good reason that you should not use global variables in a program.
Short Answer
Expert verified
Answer: Using global variables in a program is not a good practice because it can lead to unintended side effects, making the code harder to read, understand, and maintain. Global variables can be accessed and modified from any part of the program, which may result in unexpected behavior and make it difficult to track down bugs. Additionally, global variables can lead to naming conflicts, affecting multiple developers' work. It is better to use local variables with proper function parameters and return values to manage data within a program.