请教各位这道c语言哪里错了?

来源:百度知道 编辑:UC知道 时间:2024/04/30 23:47:41
用指针做:3个整数,按由小到大的顺序输出(不想用谭浩强书上的方法,我想了下面这种,只是,好多错误~~~希望各位帮帮忙,最好能给出完整的程序,谢谢了!
#include<stdio.h>

int max(int *q1,int *q2)
{
if(*q1>*q2)
return *q1;
else
return *q2;
}
void main()
{
int a,b,c,*p1,*p2,*p3,temp;
scanf("%d %d %d",&a,&b,&c);
p1=&a;p2=&b;p3=&c;
temp=max(*p1,*p2);
printf("%d",max(temp,*p3);
if(temp==*p1)
printf("%d",max(*p2,*p3);
else
printf("%d",max(*p1,*p3);
}

#include<stdio.h>

int max(int *q1,int *q2)
{
if(*q1>*q2)
return *q1;
else
return *q2;
}
int main()
{
int a,b,c,*p1,*p2,*p3,temp;
scanf("%d %d %d",&a,&b,&c);
p1=&a;p2=&b;p3=&c;
temp=max(p1,p2);
printf("%d\t",max(&temp,p3));
if(max(&temp,p3)==*p3)
{
if(temp==*p1)
{
printf("%d\t",*p1);
printf("%d\t",*p2);
}
else
{
printf("%d\t",*p2);
printf("%d\t",*p1);
}
}
else
{
if(temp==*p1)
{
printf("%d\t",max(p3,p2));
if(max(p3,p2)==*p3)
{
printf("%d\t",*p2);
}
else
{
printf("%d\t",*p3);
}
}
else
{
printf("%d\t",max(p3,p1));
if(max(p3,p1)==*p3)
{
printf