|
In a previous lab, we discussed some categories
of problems that occur with strings represented as simple arrays of
characters:
- Errors, such as array indices that are out of range.
- Static-ness, such as the inability of arrays to grow:
char s[10];
strcpy(s, "How now brown cow?"); // Not enough room!
- Unnatural/Inconvenient-ness, such as the inability to use
meaningful operators with arrays:
if (label1 > label2) // Can't do with arrays!
label1 = label2;
- Inefficiency, such as the need to traverse to the end of a string
to determine its length.
|