C语言逆序排列3个数
/* ----------------------------------------- Copyright (c) 2010-2011 Zidane Li Usage of this program is free for non-commercial use. ----------------------------------------- *//* 1.16自大至小依次输出顺序读入的三个整数*/#include <stdio.h>#include <stdlib.h>void Swap(int* a, int* b){ int* temp = (int*)malloc(sizeof(int)); *temp = *a; *a = *b; *b = *temp;free(temp);}void CompareThreeNumbers(int* a, int* b, int* c){ //将a和b排序 if (*a < *b) { Swap(a, b); } //根据c在a和b的范围,排列a、b、c if (*b < *c) { Swap(c, b);if (*a < *b) { Swap(b, a); } }}int main(){ printf("Input 3 numbers, I'll sort them ACS: "); int a, b, c; scanf("%i%i%i", &a, &b, &c); CompareThreeNumbers(&a, &b, &c); printf("%i %i %i\n", a, b, c); return 0;}?