Is #Include <string> necessary? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Is #Include <string> necessary?

Doesn't it work with #include <iostream> ?? I've never used <string> but I use strings in my programs. Anyone who can help me out with this?

16th Feb 2017, 7:16 AM
Eric Avila
Eric Avila - avatar
4 Answers
+ 4
The <string> library is included in the <iostream> library, so you don't need to include <string> separately, if you already use <iostream>.
16th Feb 2017, 8:21 AM
Alaa Yosry
Alaa Yosry - avatar
+ 2
Thanks!! ^^
16th Feb 2017, 8:36 AM
Eric Avila
Eric Avila - avatar
+ 2
"string.h" header file is for the function like strlen,strcpy,strcmp etc. without string header file you can't use these inbuilt function.
21st Feb 2017, 6:04 AM
Sanyam Jain
Sanyam Jain - avatar
0
yes, sure if have use iostream thn no need fr ds
17th Feb 2017, 12:27 AM
Yatendra Pratap Singh
Yatendra Pratap Singh - avatar