这块容易弄混,举几个简单例子:
int **
1 #include <iostream> 2 using namespace std; 3 4 int main() 5 { 6 int a = 5; 7 int *b = &a; 8 int **c = &b; 9 10 cout << "a: " << a << endl; 11 cout << "&a: " << &a << endl; 12 13 cout << "b: " << b << endl; 14 cout << "*b: " << *b << endl; 15 cout << "&b: " << &b << endl; 16 17 cout << "c: " << c << endl; 18 cout << "*c: " << *c << endl; 19 cout << "**c: " << **c << endl; 20 21 system("pause"); 22 return 0; 23 }
输出:
调试:
分析: