Whats the best (String vs. Cstring)

Hello all! I am fairly new at C++ but i am currently learning about string / c-string processing. My question is what is more efficient, strings or c-string (otherwise known as character arrays).
Efficient in what sense?

the std::string will allow you to program more efficiently in terms of how you manage your time. Of course you can use it incorrectly and write really bad programs regardless of whether you define strings as char[] arrays or std::string objects. I just don't think that it is a fair question to be honest with you. Try defining some requirements. Write the program once with only c strings and once with std::string. Profile both programs and also keep track of how much time you spent writing each program. Look at the generated assembly code for each. There are a lot of factors to consider. Then report to us which is more efficient.
The Microsoft CString was written before the STL (and thus before std::string), but they are both designed to do basically the same thing.

The STL string has better out-of-the-box interoperability with STL algorithms.
The MS string has some really nice member functions.

Choose the one that suits your needs best.
Topic archived. No new replies allowed.