#include<iostream>
using namespace std;
int main(){
int pol = 6;
int *p = &pol;
// p指向的地址与pol指向的地址相同
cout <<"p指向的地址为:" << p << endl;
cout << "pol指向的地址为:" << &pol << endl;
cout <<"*p的值为:" << *p <<endl;
cout <<"pol的值为:" << pol <<endl;
delete p;
return 0;
}
#include<iostream>
using namespace std;
int main(){
int i = 3,j = 4;
int &x = i;
int *y = &j;
cout <<"初始化引用 x: " << x <<endl;
cout <<"初始化指针 y: " << *y << endl;
return 0;
}