A char array is a static buffer that allocates x number of bytes on the programs stack (x being the number in char asdf[x]; when declaring a char array), the std::string class differs from char arrays in the sense that it dynamically allocates memory for you on initialization, this way people cannot execute standard stack based buffer overflows into your code.
In C if you do this:
This program could go as expected as planned or it could go horribly wrong. If someone enters 55 characters (let's say all B's) on that scanf call, what will that "static_important_data" var be? It'll be aaaaabbbbb (or something not far removed.)
char static_important_data = "aaaaaaaaaa";
Contra C++ and std::string where I can do this:
And I give that cin call
std::string static_important_data = "aaaaaaaaaa";
It'll still print out those ten "a"s when you call that cout because std::string automatically adjusts itself to when it's assigned. Another slight advantage is that with std::string you can do integer like comparison because it overloads the == operator.
asdkifjaowiejflewkdfjsldkfjasldkjflaskdjflaskdjfal sdkfmasldkfjasdo98fausdflijasdlfkjasdlfusaodfijasd lfkjasdlfkjasodlkfjasldfkajsdlfkajsd
For more information see here.