1.

Differentiate between global variables and local variables. Also give a suitableexample to support your answer.

Answer»

Local Variable

1.Declaration : Variables are DECLARED inside a function

2.Scope: Within a function, inside which they are declared

3.Access: ACCESSED only by the statements, inside a function in which they are declared



GLOBAL Variable

1.Declaration :Variables are declared OUTSIDE any function

2.Scope: THROUGHOUT the program

3.Access:Accessed by any statement in the entire program.



Discussion

No Comment Found