C:多级指针
/*
* os = Linux openeuler 4.19.90-2106.3.0.0095.oe1.x86_64
* gcc_version = gcc version 7.3.0 (GCC)
* file_name = pointer_test.c
* gcc -o pointer_test pointer_test.c
*
*/
#include <stdio.h>
typedef struct _people
{
int id;
int age;
} people, *people_pt, person, *person_pt;
// test pointer
int main(int argc, char** argv)
{
int x=13;
int *pt1 = NULL;
int **pt2 = NULL;
int ***pt3 = NULL;
int ****pt4 = NULL;
int *****pt5 = NULL;
int ******pt6 = NULL;
pt1 = &x;
pt2 = &pt1;
pt3 = &pt2;
pt4 = &pt3;
pt5 = &pt4;
pt6 = &pt5;
printf("pt1=%p, *pt1=%d .\n", pt1, *pt1);
printf("pt2=%p, *pt2=%p .\n", pt2, *pt2);
printf("pt3=%p, *pt3=%p .\n", pt3, *pt3);
printf("pt4=%p, *pt4=%p .\n", pt4, *pt4);
printf("pt5=%p, *pt5=%p .\n", pt5, *pt5);
printf("pt6=%p, *pt6=%p .\n", pt6, *pt6);
printf("pt6=%p, ******pt6=%d .\n", pt6, ******pt6);
return 0;
}
本文由 lnlidawei 原创、整理、转载,本文来自于【博客园】; 整理和转载的文章的版权归属于【原创作者】; 转载或引用时请【保留文章的来源信息】:https://www.cnblogs.com/lnlidawei/p/15681408.html