#include <stdio.h>
int main(){
int a = 2;
int *p = &a;
int **ptr = &p;
int ***ptr_p = &ptr;
printf("一级指针 地址 %p 值 %d \n",p,*p );
printf("二级指针 地址 %p 值 %p \n",ptr,*ptr );
printf("二级指针 取一级指针地址 %p 值 %d \n",*ptr,**ptr );
printf("三级指针 地址 %p 值 %p \n",ptr_p,*ptr_p );
printf("三级指针 取一级指针 地址 %p 值 %d \n",**ptr_p,***ptr_p );
return 0;
}
输出
一级指针 地址 0x7ffcf0c535dc 值 2
二级指针 地址 0x7ffcf0c535e0 值 0x7ffcf0c535dc
二级指针 取一级指针地址 0x7ffcf0c535dc 值 2
三级指针 地址 0x7ffcf0c535e8 值 0x7ffcf0c535e0
三级指针 取一级指针 地址 0x7ffcf0c535dc 值 2