Using String Header after IOstream header | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

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.

7th Jan 2017, 10:02 AM
Oluwaseun Prosper Popoola
Oluwaseun Prosper Popoola - avatar
2 Answers
0
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.
9th Jan 2017, 9:35 PM
Petra Stručić
Petra Stručić - avatar
0
C++ doesn't work with strings
1st Feb 2017, 10:09 PM
Ryan Beheshtian
Ryan Beheshtian - avatar