输入三个数,按从大到小排序

来源:互联网 发布:淘宝店铺营销策略 编辑:程序博客网 时间:2024/05/16 09:12
#include <stdio.h>#include <stdlib.h>swap(int *x,int *y){    int term;    if(*x<*y)    {        term=*x;        *x=*y;        *y=term;    }}int main(){    int a,b,c,*p,*q,*m;    scanf("%d %d %d",&a,&b,&c);    p=&a;    q=&b;    m=&c;    charence(p,q,m);    printf("%d %d %d",a,b,c);}    void charence(int p,int q,int m){    swap(p,q);    swap(q,m);    swap(p,m);}

这里写图片描述
熟悉函数的调用

原创粉丝点击