#include <stdio.h>
#include <stdlib.h>
int main()
{
int a,b,c,*p1,*p2,*p3;
printf("请输入三个整数:");
scanf("%d%d%d",&a,&b,&c);
p1=&a;
p2=&b;
p3=&c;
exchange(p1,p2,p3);
printf("%d %d %d",a,b,c);
return 0;
}
void swap(int *x,int *y)
{
int temp;
if(*x>*y)
{
temp=*x;
*x=*y;
*y=temp;
}
}
void exchange(p1,p2,p3)
{
swap(p1,p2);
swap(p1,p3);
swap(p2,p3);
}
心得体会:了解调用函数,指针函数的使用,swap()交换