Explain with example.
scope of the variable
The range of code in program over which a variable has a meaning is called a scope of the variable.
In other words, the scope of variable decides as to how it can be accessed by the different parts of the program.
Following are the types of scopes:
- Local scope
- Global scope
- Function scope