作者在 2020-11-24 21:39:00 发布以下内容
#include <stdio.h>
#include <string.h>
void large(double*,double*,double*);
int main()
{
double first,second,third;
printf("input first:");
scanf("%lf",&first);
printf("input second:");
scanf("%lf",&second);
printf("input third:");
scanf("%lf",&third);
printf("befor:%lf\t%lf\t%lf\n",first,second,third);
printf("\n%p\t%p\t%p\n",&first,&second,&third);
large(&first,&second,&third);
printf("\nafter:%lf\t%lf\t%lf\n",first,second,third);
return 0;
}
void large(double *a,double *b,double *c)
{
double temp;
if(*a>*b){temp=*a;*a=*b;*b=temp;}
if(*a>*c){temp=*a;*a=*c;*c=temp;}
if(*b>*c){temp=*b;*b=*c;*c=temp;}
}
#include <string.h>
void large(double*,double*,double*);
int main()
{
double first,second,third;
printf("input first:");
scanf("%lf",&first);
printf("input second:");
scanf("%lf",&second);
printf("input third:");
scanf("%lf",&third);
printf("befor:%lf\t%lf\t%lf\n",first,second,third);
printf("\n%p\t%p\t%p\n",&first,&second,&third);
large(&first,&second,&third);
printf("\nafter:%lf\t%lf\t%lf\n",first,second,third);
return 0;
}
void large(double *a,double *b,double *c)
{
double temp;
if(*a>*b){temp=*a;*a=*b;*b=temp;}
if(*a>*c){temp=*a;*a=*c;*c=temp;}
if(*b>*c){temp=*b;*b=*c;*c=temp;}
}