C ++ input to string or char []?

Recently, I asked a question to bother me for days. Does the row type have some type of memory management already or what because I can do such a thing

string a;
cin >> a;

Not knowing how long it will be. Why do some people (some of the YouTube tutorials) use a char array (C style) and then take care of indexing when they can just make it easier with string types?

Thank!

+4
source share

All Articles