65,210
社区成员
发帖
与我相关
我的任务
分享
#include <iostream>
char arr1[10];
int main()
{
using std::cout;
using std::endl;
int *p1;
int *p2;
p1=new int;
p2=new (arr1) int[10];
*p2=20;
*p1=10;
cout << *p1 << endl;
cout << *p2 << endl;
delete p1;
//delete p2; //为何这一句释放会报错呢?
return 0;
}