Using String Header after IOstream header | Sololearn: Learn to code for FREE!


Using String Header after IOstream header

Honest question here, what,s the point of declaring a #include <string> header when a #include <iostream> header was already declared. I always thought the string declaration is already available in the iostream standard library, except I have a wrong thought.

1/7/2017 10:02:28 AM

Oluwaseun Prosper Popoola

2 Answers

New Answer


C++ in its beginnings didn't know how to work with strings. Strings used to be represented as arrays of characters. So, I assume, that's the reason why string declaration is not in iostream declaration - it was added later, and needed a whole new header for itself since C++ is not "made to" work with strings.


C++ doesn't work with strings