高级引用机制C++
发布时间
阅读量:
阅读量
编写程序,多级指针
#include<iostream>
using namespace std;
int main()
{
int a = 211;
int* p1 = &a;
int** p2 = &p1;
int*** p3 = &p2;
cout << "a=" << a
<< "\t\t*p=" << *p1 // a = 211 * p = 211 * *p2 = 211 * **p3 = 211
<< "\t\t**p2=" << **p2
<< "\t\t***p3=" << ***p3 << endl;
cout << "&a=" << &a; //输出的是地址
cout << endl;
cout << "p1=" << p1; //输出的是地址
return 0;
}
全部评论 (0)
还没有任何评论哟~
