I use Dev-C++ which has GCC 4.9.2 C++ compiler. I am confused on where and where not to use the following for declaring a string variable:
#include <string>only#include <string.h>only- using
std::stringonly and no headers #include <cstring.h>
because everything compiles and run in devc++, I am unable to understand the concept behind all these
To use
std::stringalways use#include <string>.The other header files you mentioned have nothing to do with
std::string.The
stdnamespace scope can be omitted if you have an appropriateusingstatement likeor
(the latter isn't recommended in real code for various reasons)