4.1 指针的指针

目录

情况:
    int a = 20;
    int *b = &a;
    int **c = &b;
b是一个“指向整型的指针”。
c是一个“指向整型的指针”的指针。
其中,a = 20
        b = &a
      *b = a , 20
        c = &b
      *c = b , &a
    **c = *b , a ,20

 

 1 #include <stdio.h>
2
3 void main()
4 {
5 int a = 20;
6 int *b = &a;
7 int **c = &b;
8
9 printf(" a value = %d , a addr = %p\n",a,&a);
10 printf(" b value = %p , b addr = %p ,*b = %d\n",b,&b,*b);
11 printf(" c value = %p , c addr = %p ,*c = %p , **c = %d\n",c,&c,*c,**c);
12 }
13
14 -----------------------------
15 运行:
16 wyj@t468 ~ $ ./a.out
17 a value = 20 , a addr = 0xbf99e70c
18 b value = 0xbf99e70c , b addr = 0xbf99e708 ,*b = 20
19 c value = 0xbf99e708 , c addr = 0xbf99e704 ,*c = 0xbf99e70c , **c = 20

 

posted @ 2012-02-07 19:50  遥远的进  阅读(144)  评论(0编辑  收藏  举报