What is the difference between a local variable and a global variable?
Q1. What is the difference between a local variable and a global variable?
Answer: A local variable is accessible only within a specific scope, while a global variable is accessible throughout the program
Explanation: A local variable is declared within a specific scope and is accessible only within that scope, while a global variable is declared outside any scope and is accessible throughout the program.