See related link.
A global variable is available for use throughout the program. It is normally declared outside any procedure. A local variable is only available for use in the procedure it was declared in. Most variables are local, but there will be occasions when you want different procedures to be able to use the same variable. This is when you use a global variable.
global
It's a global variable.
global and static
Global Varible: The variable which is declared as "Global" one : having the preveleges to use and access that variable in any class and object( means any where in the program) just like PUBLIC keyword in OOPS concepts. Static Variable : If we declare a variable as Static , then it wont have the permission to access that variable through out the program and u have to use it inside the class or object which u declared itself. All the Best Annapurna
Variables that are declared globally outside every program are called global variables.
A global declaration of a function or variable is a declaration that is at the global scope of the program, not inside another function. This means that the name will be visible within all functions in the program.
Your program won't work correctly.
a variable that is defined within a block is considered to have local scope, i.e., it is only visible to the block that contains it. Its lifetime is also limited unless it is marked as a 'static' variable, in which case it will exist for the entire length of program execution.
When you acess a global variable inside main function you must use the same name, because the variable declared as global can be accessed by any function/procedure on the class where it was defined.
Scope of static variable is with in the file if it is static global. Scope of static variable is with in the function if variable is declared local to a function. But the life time is throughout the program
1.In computer programming, a global variable is a variable that is accessiblein every scope.2.There are some variables that are used in more than one function.suchvariables are called global variables.3.Usually,they are declared in global declaration section that is outsideof all functions.4.In this section,we can also declare all user-defined functions.DECLARATION:int global =5;