Storage Classes

C provides five different models, or storage classes, for variables. There's also a sixth model, based on pointers, that we'll get to later in this chapter (“Allocated Memory”). You can describe a variable (or, more generally, a data object) in terms of its storage duration, which is how long it stays in memory, and its scope and its linkage, which together indicate which parts of a program can use it by name. The different storage classes offer different combinations of scope, linkage, and storage duration. You can have variables that can be shared over several files of source code, variables that can be used by any function in one particular file, variables that can be used only within a particular function, even variables that ...

Get C Primer Plus, Fourth Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.