动态分配与释放 单个数据的存储区
#include<iostream>
using namespace std;
int main() {
int *p;
p = new int;
if (p == NULL)
{
cout << "allocation failure" << endl;
}
else
{
*p = 15;
cout << "p 的值为: "<<*p << endl;
delete p;
}
return 0;
}

浙公网安备 33010602011771号