dimanche 2 avril 2017

Why is it valid to get string[0] even when it has not been initialized?

Consider this code

string str;
cout << str[0] << str.size();

And what I get is not a run time error, but " 0", a 0 following a space. Why is this possible?

Aucun commentaire:

Enregistrer un commentaire