Q. What is meaning of scope of the variable and life of the variable?
Explain with example.
Ans.
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:
Explain with example.
Ans.
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
Life of the variable
Life of the variable means how long would the variable exist.
Related Article:
Comments
Post a Comment