#include <stdio.h>
#include <stdlib.h>
void swap (int *x, int *y)
{
int temp;
if(*x>*y)
{
temp=*x;
*x=*y;
*y=temp;
}
}
void xechange(int *a, int *b, int *c);
int main()//输入3个整数,按从小到大在顺序输出
{
int a, b, c, *p1, *p2, *p3;
scanf("%d%d%d",&a, &b, &c);
p1=&a;
p2=&b;
p3=&c;
exchange(p1, p2, p3);
printf("%d %d %d\n",a, b, c);
return 0;
}
void exchange(int *a, int *b, int *c)
{
swap(a,b);
swap(a,c);
swap(b,c);
}
知识点:使用调用函数
心得体会:合理运用程序,更好使用函数