Glossary: Scope
The scope of a variable determines what parts of the
program can access it directly. Its sometimes referred to
as visibility.
In FORTRAN the concept
of scope is very rudimentary, variables are either:-
- local - declared within a subroutine or function and only visible
to that routine
- global - declared in a COMMON block and visible to any routine
that includes the COMMON
In C++ the concept is much richer. Variables can be:-
- global - visible to any code so long as the appropriate
header_file
is included.
- file - visible within the file in which it is defined.
- class - visible within a class object.
data members
and
member functions
have class scope.
- local - visible only within the function in which it is defined
and restricted to the innermost
compound statement
that encloses the definition.
See
{..}
Go Back to the
The Glossary Top Page
If you have any comments about this page please send them to
Nick West