Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free.

The last week I saw at least three questions where people were confused about the differences between char * and std::string or made some related mistakes.

Don't get me wrong, I don't have a problem with this, I just don't get the exact reason for this. Maybe it was just a coincidence.

share|improve this question
It wasn't confusion on my part but dealing with strings (and all their variety) in C++ made me want to go work in a different language. –  Ken Henderson Nov 27 '10 at 21:49
@confusedGeek: That's actually not a bad idea... –  Mason Wheeler Nov 27 '10 at 22:46
This question should only be tagged as C++ as there is no such confusion in C since C does not have an std::string. –  Brian R. Bondy Nov 28 '10 at 0:46

2 Answers 2

up vote 9 down vote accepted

Given that things like

std::string myString = "Hello, world!";

are perfectly valid, it seems rather obvious to me why there is confusion.

share|improve this answer

Because they're both commonly known as "strings" in a language that has no real string type. It's very understandable that inexperienced coders would be confused by that...

share|improve this answer
+1 for no real string –  Kugel Nov 28 '10 at 5:35

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.