这个程序哪里错了?
#include<stdio.h>void swap(int a,int b)
{
int t;
t=a;
a=b;
b=t;
}
main()
{
int x,y;
printf("input x and y:");
scanf("%d %d",&x,&y);
swap(x,y);
printf("result:x=%d,y=%d\n",x,y);
}
#include <stdio.h> void swap(int *pm, int *pn) { int tmp; tmp = *pm; *pm = *pn; *pn = tmp; } void sortdown(int *px, int *py, int *pz) { if(*px < *py) swap(px, py); if(*px < *pz) swap(px, pz); if(*py < *pz) swap(py, pz); } void sortup(int *px, int *py, int *pz) { if(*px > *py) swap(px, py); if(*px > *pz) swap(px, pz); if(*py > *pz) swap(py, pz); } int main(void) { int a, b, c, *pa, *pb, *pc; scanf("%d%d%d", &a, &b, &c); pa = &a; pb = &b; pc = &c; sortup(pa, pb, pc); printf("%d\t%d\t%d\n", a, b, c); sortdown(pa, pb, pc); printf("%d\t%d\t%d\n", a, b, c); return 0; }