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 line[MAXLINE]; // what's the longest line?
char words[MAXWORDS][MAXWORDLENGTH];
// how many words are there?
// how long is each word?
|
With fixed-size data, we need to guess sizes ("large enough").
|