c++ - Char* vs std::string -
possible duplicate:
c++ char* vs std::string
is there advantage using char*'s instead of std::string?
i know char*'s defined on stack, know how memory we'll use, argument use? or std::string better in every way?
if you're writing in c++ std::string better in cases you'll encounter. instead, few cases when might want use char*'s:
-compatibility old c code (although std::string's c_str() method handles of this)
-to conserve memory (std::string have more overhead)
-cases want make sure know memory at, such network code or shared memory
Comments
Post a Comment