+ 2

So then, what is a scope and why does it need to be resolved?

A scope is the extent to which something can be worked with, inside the {block} which is called LOCAL variables, in the definition of function parameters declared in the function declaration, e.g., foo(6); which is called formal parameters and outside of all functions which is called GLOBAL variables.

7th May 2018, 11:44 PM
Michael Michael
Michael Michael - avatar
2 odpowiedzi
+ 1
Scope of a variable or function is the lifetime of that variable or function.
15th May 2018, 9:41 AM
Vishwajeet
Vishwajeet - avatar
0
A variable or function defined outside all the functions (called global) can be accessed in any function. A variable or function defined inside a function(called local) cannot be accessed outside that function. That is why, we need to resolve them. We have to fix that function or variable only called in that function(if local) or called in entire program(if global).
15th May 2018, 9:48 AM
Vishwajeet
Vishwajeet - avatar