Storage Classes
Before beginning this lesson, you should read sections 7.1-7.2 and 7.4-7.7 of
the text. We will be skipping over the remainder of the sections, but feel
free to read them if you wish.
You should use level 5 of C-thru for this lesson.
We will be looking at a variety of topics in this lesson, but they all have to
do with the visibility of variable names in programs with multiple functions
and/or multiple files. We will focus on three kinds of storage classes:
auto, extern, and static.
Every variable that you declare and use in a program belongs to a storage
class. The storage class of a variable controls:
- when (during program execution) it is allocated in memory,
- when (during program execution) it is initialized,
- where (in the program) it is visible, and
- when (during program execution) it is deallocated from memory.
If you click below, I'll copy some more example files to your directory.
Click here to copy files
Hamlet Project
hamlet@cs.utah.edu