Global variables are proclaimed outside any function, and they can be gotten to (utilized) on any function in the program. Local variables are proclaimed inside the function and can be utilized just inside that function. It is conceivable to have local variables with a similar name in various functions.
Global Variables:
1) Declaration – Variables are proclaimed outside any function.
2) Scope – Throughout the program.
3) Access – Accessed by a statement in the whole program.
4) Life – Remain in presence for the whole time your program is executing.
5) Storage – Stored on a settled area chosen by a compiler.
Local Variable:
1) Declaration – Variables are pronounced inside a function.
2) Scope – Within a capacity, inside which they are proclaimed.
3) Access – Accessed just by the statements, inside a function in which they are proclaimed.
4) Life – Created when the function block is entered and annihilated upon exit.
5) Storage – Local variables are put away on the stack except if determined.
Regards,
Nitesh Bavishiya