为啥会这样,初学者看不懂
#include<stdio.h>
void swap(int*x,int*y)
{
int temp=*x;
*x=*y;
*y=temp;
}
int main()
{
void exchange(int *q1,int *q2,int q3);
int *p1,*p2,*p3,a,b,c;
printf("please enter a,b,c:\m");
scanf("%d%d%d",&a,&b,&c);
p1=&a;
p2=&b;
p3=&c;
exchange(p1,p2,p3);
printf("The order is:%d %d %d",a,b,c);
return 0;
}
void exchange(int *q1,int *q2,int *q3)
{
if(*q1<*q2) swap(q1,q2);
if(*q1<*q3) swap(q1,q3);
if(*q2<*q3) swap(q2,q3);
}