
#include<iostream>
using namespace std;
int add(int a, int b)
{
int* c = &a;
cout << "函数中临时变量的地址: " << c << endl;
return a + b;
}
int main()
{
int* p = new int(6);
int** pp = &p;
cout << p << endl; // 0000022E76266FB0 p指向堆中为变量分配内存空间的地址
cout << pp << endl; // 000000A77D93F8B8 pp为p所在的地址,在栈中
cout << add(1, 2) << endl; // 000000A77D93F890 局部变量的地址也在栈中
delete(p);
p = nullptr;
return 0;
}