指针的指针
这块容易弄混,举几个简单例子:
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:\t" << a << endl; 11 cout << "&a:\t" << &a << endl; 12 13 cout << "b:\t" << b << endl; 14 cout << "*b:\t" << *b << endl; 15 cout << "&b:\t" << &b << endl; 16 17 cout << "c:\t" << c << endl; 18 cout << "*c:\t" << *c << endl; 19 cout << "**c:\t" << **c << endl; 20 21 system("pause"); 22 return 0; 23 }
输出:
调试:
分析: