English
Tamil Nadu Board of Secondary EducationHSC Science Class 12

Define the Enclosed scope with an example. - Computer Science

Advertisements
Advertisements

Question

Define the Enclosed scope with an example.

Short Note

Solution

Enclosed Scope:

All programming languages permit functions to be nested. A function (method) within another function is called a nested function. A variable that is declared inside a function that contains another function definition within it, the inner function can also access the variable of the outer function. This scope is called the enclosed scope. When a compiler or interpreter search for a variable in a program, it fist search Local and then search Enclosing scopes. Consider the following example

shaalaa.com
Types of Variable Scope
  Is there an error in this question or solution?
Chapter 3: Scoping - Evaluation [Page 29]

APPEARS IN

Samacheer Kalvi Computer Science [English] Class 12 TN Board
Chapter 3 Scoping
Evaluation | Q 3. | Page 29
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×