<分区>
我有以下代码:
string s = "haha";
cout << s << endl; //haha
cout << s.length() << endl; //4
cout << (s[25] == 'h' ? "is h" : "is not h") << endl; //is not h
cout << s[0] << endl; // h
cout << s[25] << endl; // nothing...blank
似乎指向任何索引,即使它超出范围也不会抛出任何错误......这是什么原因?