qfedu-c-level/day9/d13.c

20 lines
418 B
C

// 指针的指针
// 指针变量也是变量,也有自己的内存空间
#include <stdio.h>
int main()
{
int a = 20;
int *p = &a;
*p = 50;
int **q = &p; // q 指向 int ** 类型
**q += 100;
printf("p = %p, *q = %p\n", p, *q); // p = 0x7ffeeb0b0a3c, *q = 0x7ffeeb0b0a3c
printf("a = %d, *p = %d, **q = %d\n", a, *p, **q); // a = 50, *p = 50, **q = 50
return 0;
}