Tamil Nadu Board of Secondary EducationHSC Science Class 12th

Define Global scope with an example. - Computer Science

Advertisement Remove all ads
Advertisement Remove all ads
Advertisement Remove all ads
Short Note

Define Global scope with an example.

Advertisement Remove all ads

Solution

Global Scope:

A variable that is declared outside of all the functions in a program is known as a global variable. This means a global variable can be accessed inside or outside of all the functions in a program. Consider the following example 

On execution of the above code the variable a which is defined inside the function displays the value 7 for the function call Disp( ) and then it displays 10 because a is defined in the global scope.

Concept: Types of Variable Scope
  Is there an error in this question or solution?

APPEARS IN

Share
Notifications

View all notifications


      Forgot password?
View in app×