Scope Resolution
Scope Resolution
What Is Scope
• A scope is a region of the program where the variables can be accessed.
• A scope contains a group of statements and variables. The variables declared within a
• Programmers can declare the variables both inside and outside of block.
Types of Scope
The global scope refers to the region outside any block or function.
• The variables declared in the global scope are called global variables
• Global is also called File Scope as the scope of an identifier starts at the beginning of the
Global variables have external linkage by default. It means that the variables declared
in the global scope can be accessed in another C source file. We have to use
Output
2
2. Local Scope in C
The local scope refers to the region inside a block or a function. It is the space enclosed between the { }
braces.
•The variables declared within the local scope are called local variables.
•Local variables are visible in the block they are declared in and other blocks nested inside that block.