数组下表越界,搞不懂哦,求解答

数组下表越界,搞不懂哦,求解答
#include
#include
#include
#include
#include
using namespace std;
int main()
{
string *str2 = new string[10];
cin>>str2[0];
for (int n=0;str2[0][n]!='\0';n++)
cout<<str2[0][n];
delete []str2;
system("pause");
return 0;
}

图片说明

cout能把cin的字符输出完整,之后马上就报错了

for循环改成for(。。。;n<10;。。。)试试还越不越界!

 int main()
{
    string *str2 = new string[10];
    cin >> str2[0];
    for (int n=0;str2[0][n]!='\0';n++)

        cout<<str2[0][n];

    delete []str2;
    system("pause");
    return 0;
}

测试没有错。。

=。= 以上是 VS2010做的就报错,,我刚试了一下 VS2015就不报错,我擦嘞