讨论一个程序(常量数组和普通常量const)
测试程序:#include <iostream>
using namespace std;
int main()
{
int const c1=4;
int const c2[1]={2};
*(int *)&c1=5;
*(int *)&c2[0]=9;
cout<<c1+c2[0]<<endl;
return 0;
}
using namespace std;
int main()
{
int const c1=4;
int const c2[1]={2};
*(int *)&c1=5;
*(int *)&c2[0]=9;
cout<<c1+c2[0]<<endl;
return 0;
}
结果如何?