Storage Classes, Scope, and Linkage

Now that you've seen a multifile program, it's a good time to extend the discussion of storage classes in Chapter 4, "Derived Types," for storage classes affect how information can be shared across files. It might have been a while since you last read Chapter 4, so let's review what it said about storage classes. C++ uses three separate schemes for storing data, and the schemes differ in how long they preserve data in memory.

  • Automatic variables are those declared inside a function definition; that includes function parameters. They are created when program execution enters the function or block in which they are defined, and the memory used for them is freed when execution leaves the function or block.

  • Static ...

Get The Waite Group's C++ Primer Plus, Third Edition 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.