Differences between string headers. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Differences between string headers.

I'm a bit confused, for me it seems the same, I have this headers: #include<string> #include<string.h> #include<cstring> what are the differences between this headers? which one are C++ header and C header? is it better to use C++ headers instead C? besides, I'm learning how to get a string from the user, why Can I use std::string without the headers above? or Do I need to include any header above to use std::string?

17th Jul 2018, 4:11 AM
Eduardo Perez Regin
Eduardo Perez Regin - avatar
1 Answer
+ 6
string is the C++ header, which contains std::string cstring is the C++ version of the C header string.h is the C header
17th Jul 2018, 4:43 AM
Baptiste E. Prunier
Baptiste E. Prunier - avatar