Fork me on GitHub

指针的指针

示例

 1 #include <iostream>
 2 using namespace std;
 3 int main()
 4 {
 5     int a = 35;
 6     int *b1 = &a;
 7     int **b2 = &b1;
 8     cout << a << "    "<< *b1 << "     "<< **b2 << "     "<< endl;
 9     return 0;
10 }

结果:35   35    35

示例2

#include <iostream>
using namespace std;
int main()
{
    int a = 35;
    int *b1 = &a;
    int **b2 = &b1;
    cout << a << "    "<< b1 << "     "<< *b2 << "     "<< endl;
    return 0;
}

结果:35   002FFC84   002FFC84

示例3

#include <iostream>
using namespace std;
int main()
{
    int a = 35;
    int *b1 = &a;
    int **b2 = &b1;
    cout << a << "    "<< b1 << "     "<< b2 << "     "<< endl;
    return 0;
}

结果:35   0035F7F0   0035F7E4

posted @ 2015-07-01 09:07  夏成都  阅读(160)  评论(0编辑  收藏  举报