输入3个整数,按大小顺序输出。久久为何运行不出正确结果!
程序代码:#include<stdio.h>
void main()
{ void exchange(int *q1,int *q2,int *q3 );
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",a,b,c);
}
void exchange(int *q1,int *q2,int *q3 )
{ void swap(int *qt1,int *qt2);
if(*q1<*q2)swap(q1,q2);
if(*q1<*q3)swap(q1,q3);
if(*q2<*q3)swap(q2,q3);
}
void swap(int *qt1,int *qt2)
{ int temp;
temp=*qt1;
*qt1=*qt2;
*qt2=temp;
} 不知哪里错了。。。。









