菜鸟向c语言们请教

来源:百度知道 编辑:UC知道 时间:2024/05/19 08:47:44
定义三个变量a, b, c,键入他们的值,求出其最小值,要求用子函数实现求最小值的功能,其中函数的形参是三个指针变量,返回值是其中的最小值的指针。
谢谢了

#include "stdio.h"
void Sort(int*a,int*b)
{
int temp;
if(*a>*b)
{
temp=*a;
*a=*b;
*b=temp;
}
}
void main()
{
int a,b,c;
printf("输入a,b,c的值:");
scanf("%d%d%d",&a,&b,&c);
Sort(&a,&b);
Sort(&a,&c);
Sort(&b,&c);
printf("a=%d,b=%d,c=%d",a,b,c);

}
给你吧

我回答了你的问题。