Dynamic Memory Allocation (cont)
In many applications, fixed-size data is ok.
In many other applications, we need flexibility.
Examples:
char name[MAXNAME]; // how long is a name?
char item[MAXITEMS]; // how high can the stack grow?
char dictionary[MAXWORDS][MAXWORDLENGTH];
// how many words are there?
// how long is each word?
|
With fixed-size data, we need to guess sizes ("large enough").
|