Memory Management: Storage Classes

The lexical scope discussed in the previous section is a compile-time characteristic of the program. It defines the segments of the program source code where a particular name is known. However, it does not define when memory is allocated for a particular variable during execution and when this memory is taken away and made available for other uses. The rules of memory allocation at run time depend on another characteristic of programmer-defined names: their storage class (or extent).

Storage class refers to a span of execution time when the association between a name of a variable and its location in memory is valid, that is, when the storage is allocated for that variable. Unlike lexical scope, storage class ...

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.