#include<iostream>
using namespace std;
int data=23;
int main()
{
int i=15;
int *ptr=new int(8);
cout<<"code address:"<<&main<<endl;
cout<<"global datum address:"<<&data<<endl;
cout<<"local datum address:"<<&i<<endl;
cout<<"pointer address:"<<&ptr<<endl;
cout<<"head address:"<<ptr<<endl;
cout<<"datum in heap:"<<*ptr<<endl;
delete ptr;
}
code address:1//主函数地址
global datum address:0x46a010//堆区地址
local datum address:0x23fe3c//局部变量地址
pointer address:0x23fe30//指针地址
head address:0x371410//指针指向堆区的地址
datum in heap:8
--------------------------------
Process exited after 0.9094 seconds with return value 0
请按任意键继续. . .