3 struct p
4 { unsigned int id;
5 unsigned int age;
6 unsigned int sex;
7 };
8
9
10 int main(void)
11 {
12
13 struct p *p1;
14
15 unsigned int *pp1;
16
17
18 p1 = malloc(sizeof(struct p));
19 p1->id = 3;
20 p1->age = 22;
21 p1->sex = 1;
22
23 pp1 = p1;
24
25 printf("the pp1 is: 0x%x, the value is: 0x%x/n",pp1++,*pp1);
26
27
28 printf("the pp1 is: 0x%x, the value is: 0x%x/n",pp1++,*pp1);
29
30 printf("the pp1 is: 0x%x, the value is: 0x%x/n",pp1,*pp1);
31
32 _exit(0);
33 }
【C语言编程技巧】快速访问结构体成员的一种方法
最新推荐文章于 2022-05-21 23:09:24 发布