Scope of variable

The scope of the variables can be broadly be classified as

  • Local Variables
  • Global Variables

Local Variables:

The variables defined local to the block of the function would be accessible only within the block of the function and not outside the function. Such variables are called local variables.

Global Variables:

Global variables are one which are visible in any part of the program code and can be used within all functions and outside all functions used in the program. The method of declaring global variables is to declare the variable outside the function or block.

Back