August 2002
Beginner
1122 pages
22h 1m
English
So far, we've encountered two storage classes: static and auto. As you might recall from the discussion in Chapter 5, static variables are allocated memory when the program is linked, while the memory for auto variables is assigned to them at entry to the block where they are defined. However, both mechanisms have a major limitation; the amount of memory needed is fixed when the program is compiled. In the case of a string, we need to allocate an amount of memory that in general cannot be known until the program is executed, so we need another storage class.
As you will be happy to learn, there is indeed another storage class called dynamic storage that enables us to decide the amount of memory to ...
Read now
Unlock full access