#include<stdio.h>
main()//int a,int b
{
printf("请输两位数字\n") ;
int a,b,*pa,*pb,temp;
pa = &a;
pb = &b;
scanf("%d %d",pa,pb);/*错误格式scanf(”%d%d“,*pa,*pb)因为前面定义了pa=&b已经取完地址了,再
定义*pa的话就回到前面那个总定义那笔哪去了程序就会报错*/
printf("*pa=%d,*pb=%d\n",*pa,*pb);//*pa=11 *pb=22
printf("a=%d,b=%d\n",a,b);//a=11 b=22
if(a<b)
{
temp = *pa;
*pa = *pb;//交换位置
*pb = temp;
}
printf("a=%d b=%d\n",a,b);//a=22 b=11
printf("pa=%d pb=%d\n",*pa,*pb);//*pa = 22 *pb = 11
printf("*pa=%d *pb=%d\n",pa,pb);
}
//先定义后赋值
int a,b,*pa,*pb
pa = &a;
pb = &b;
printf("%d%d",pa,pb);
//int *pa 中int *是指指针的类型(整型)pa指的是变量名;