CS 3304: Comparative Languages
Names and Binding
[
Course Documents
] : [
Names and Binding
]
Previous
Contents
Next
Keyword Index
Scope
The
scope
of a variable is the range of statements over which it is visible
The
nonlocal
variables of a program unit are those that are visible but not declared there
The scope rules of a language determine how references to names are associated with variables
Scope and lifetime are sometimes closely related, but are different concepts!!
Consider a static variable in a C or C++ function