1 #include <stdio.h>
2 #include <stdlib.h>
3
4 //数据通信
5 void main()
6 {
7 int num = 10;
8 int *p1 = #
9 int *p2 = p1;
10 printf("\n%d,%d,%d",num,*p1,*p2);
11 printf("\n%x,%x,%x",&num,p1,p2);
12
13 *p2 = 20;
14 printf("\n%d,%d,%d",num,*p1,*p2);
15 printf("\n%x,%x,%x",&num,p1,p2);
16 getchar();
17
18 }
1 #include <stdio.h>
2 #include <stdlib.h>
3
4 void main1()
5 {
6 int num = 100;
7 char ch = 'a';
8 double db = 19.7;
9 char *p1,*px;
10 int *p2;
11 double *p3;
12 printf("\n%d,%d,%d",sizeof(ch),sizeof(num),sizeof(db));
13 printf("\n%d,%d,%d",sizeof(p1),sizeof(p2),sizeof(p3));//指针都是四个字节
14 p1 = &ch;
15 px = p1;//p1 px同一个类型 无错误
16 printf("\n%c",*px);
17 //p2 = p1;
18 printf("\n%x",p1);
19 //不是同一个类型的指针 不可以任意赋值
20 //不同的类型 大小不一样 解析方式不一样
21 getchar();
22
23 }