Home Segments Index Top Previous Next

133: Mainline

The memory set aside for a global variable is never reallocated, so global variables are said to have static extent. The memory allocated for parameters and local variables is reallocated as soon as the corresponding function has finished executing, so parameters and local variables are said to have dynamic extent.

Global variables can be evaluated and assigned at any point in a program after they are defined, so global variables are said to have universal scope. Parameters and local variables can be evaluated and assigned only in the function in which they are declared. Accordingly, parameters and local variables are said to have local scope.