What is the difference between local and global variables in C language?
A. Local variables are declared inside a function and global variables are declared outside any function
B. Local variables have a scope within the function where they are declared and global variables have a scope throughout the program
C. Local variables are created when the function is called and destroyed when the function is exited and global variables are created at the start of the program and destroyed at the end of the program
D. All of the above
Answer:D
What is the difference between local and global variables in C language?
A. Local variables are declared inside a function and global variables are declared outside any function B. Local variables have a scope within the function where they are declared and global variables have a scope throughout the program C. Local variables are created when the function is called and destroyed when the function is exited and global variables are created at the start of the program and destroyed at the end of the program D. All of the above
Explanation: Based on their scope and lifetime, local and global variables are two different types of variables in the C language. The scope of local variables is limited to the function in which they are declared. When the function is called, they are created, and when the function is ended, they are destroyed. Global variables have a scope across the entire program and are declared outside of any function. At the beginning of the program, they are created, and at its conclusion, they are destroyed.