2.1 引用
2.2 指针
初始化操作和表达式中的 * ,& 是不一样的
int *p = &i;
// p 被初始化,并存放 i 的地址p = &b;
// 将 p 指向 b*p = 0;
// 将 p 指向的对象赋值为 0案例代码
表达式中使用 *p 就相当于操作 p 指向的对象,p 就是地址 ```cppinclude
using namespace std;
int main()
{
int test = 321;
int& refTest = test;
refTest++;
cout << “test: “ << test << endl;
int p = &refTest;
cout << “p指向的对象的内容” << p << endl;
int p2 = p;
cout << “p2也即p指向的对象的内容” << p2 << endl;
cout << “p的地址” << p << “\tp2的地址” << p2;
return 0;
}
```
输出为