Differentiate between local and global variables.
Question :
Differentiate between local and global variables.
A local variable is one that defined within a function. The scope of a local variable is limited to the function in which it is defined. The life of local variable is limited to the function. Global variable is defined outside the function block. The scope of global variable is throughout the program. The life of global variable is throughout the program.