Name Scope as a Tool for Cooperation

Each programmer-defined name, or identifier, has its lexical scope in the C++ program (often called just scope).

It is called lexical because it refers to a source code segment where the name is known and can be used. It is called scope because outside of this code segment the name is either not known or refers to a different entity. The entities whose names have scopes are the names of programmer-defined data types, functions, parameters, variables, and labels. The possible uses of the names known within the scope include definitions, expressions, and function calls.

C++ Lexical Scopes

Lexical scope is a static name characteristic. This means that the scope is defined by the lexical structure of the program ...

Get Core C++ A Software Engineering Approach now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.