Variable whose existence is known only to the main program or functions are called local variables. Local variables are declared with in the main program or a function.
Variables whose existence is known to the both main() as well as other functions are called global variables. Global variables are declared outside the main() and other functions.
The following Program illustrates the concept of both local as well as global variables.