指向指针的指针
2024-01-04 11:53 钟铧若岩 阅读(6) 评论(0) 编辑 收藏 举报void func(int **a) { int **p = a; *p = new int (3); cout<<"p="<<p<<"*p="<<*p<<"**p="<<**p<<endl; }
int *a = 0; func(&a); cout<<"a="<<a<<"*a="<<*a<<endl; delete a; cout<<"a="<<a<<"*a="<<*a<<endl;
输出的结果是:
p=0x7ffde37b1420*p=0x18472c0**p=3
a=0x18472c0*a=3
a=0x18472c0*a=0