Chapter 5: Problem 10
What is a local variable? How is access to a local variable restricted?
Short Answer
Expert verified
Answer: The purpose of restricting access to local variables is to prevent unintended modifications, maintain the modularity of the code, and allow better management of resources. This access restriction ensures that different parts of the program are isolated, making them independent and less prone to errors. It also enables efficient memory usage, as local variables are created and used when needed, and automatically destroyed once their purpose is served.