whats the difference between C Strings and C++ strings. Specially while doing dynamic memory allocation
The difference is speed in some operations, and encapsulation of places where common errors occur. std::string maintains information about the content and length of the string. This means it is not prone to buffer overruns in the same way a const char * is. It will also be faster for most operations than a const char * because the length of the string is known. Most of the cstring operations call strlen() under the hood to find out the length of the string before operating on it, this will kill performance. std::string is compatible with STL algorithms and other containers.
Lastly, std::string doesn't have the same "gotcha!" moments a char * will have: