Variable Scope

A variable's scope begins at its declaration and ends at the end of the compound statement in which it is defined. If the variable is declared outside of all compound statements then it has global scope, in which case it may be referenced from any user defined function that follows it in the source text.

It is illegal to reference a variable from outside its scope.