Question 2
Back to Exercise
Which is an advantage of std::string over a char array?
- A It cannot be modified
- B It manages its own memory, knows its length and supports =, + and == Correct
- C It uses no memory
- D It can only store letters
Correct Answer: Option B
No fixed buffer to overflow, no manual strcpy/strcat, and comparisons compare contents rather than addresses.
Discussion & Comments 0
Share your method, a shortcut, or ask about a step you didn't follow.
No comments yet. Be the first to share your solution!