S.no Local Variable Global Variable
1. Declared inside function Declared outside function
2. Accessed only by statements that are inside a function where they are declared Accessed by any statement throughout the program
3. Created when entering function block and gets destroyed when exits. Stays in existence throughout the when the application is executing
4. It is stored on the stack. Stored in a fixed location.

Suggest An Answer