+ 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.
2 odpowiedzi
+ 1
Scope of a variable or function is the lifetime of that variable or function.
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).