Ch. 6.10: Local and Global Variables Flashcards
1
Q
What is a local variable?
A
A local variable is defined inside a function and is not accessible outside the function.
2
Q
What is a global variable?
A
A global variable is defined outside all functions and is accessible to all functions in its scope.
3
Q
What is the lifetime of a local variable?
A
A function’s local variables exist only while the function is executing.
4
Q
What is a global constant?
A
A named constant that is available to every function in a program.
5
Q
What does shadow mean?
A
This means that the global variable or constant’s name is hidden by the name of the local or parameter variable.