<分区>
我尝试使用以下代码示例删除一个 ptr:
int* data = new int(1);
int* p = NULL;
p = data;
*p = 3;
delete p;
// Prints 3
cout << *p << endl;
//Prints 3
cout << *data << endl;
The last two lines of code prints 3, and my question is what is deleted after
delete p
? According to what it prints out from the last two lines of code, it seems like nothing is deleted 0.0~~
有人请给我解释一下。提前谢谢大家。