1.输入三个数字,使用指针的方法将其比较大小结果输出
#include<stdio.h>
#include<math.h>
void main(){
int a=6,b=5,c=4;
int *q1,*q2,*q3;
void swap(int *q1,int *q2);
q1=&a;
q2=&b;
q3=&c;
printf("%d %d %d\n",a,b,c);
if(a>b){
swap(q1,q2);
}
if(a>c){
swap(q1,q3);
}
if(b>c){
swap(q2,q3);
}
printf("%d %d %d",a,b,c);
}
void swap(int *q1,int *q2){
int temp;
temp=*q2;
*q2=*q1;
*q1=temp;
}