int swap(int *a,int *b);
void main()
{
int x=7, y=11;
printf("before swapped: ");
printf("x=%d,y=%d\n",x,y);
y=swap(&x,&y);
printf("after swapped: ");
printf("x=%d,y=%d\n",x,y);
}
int swap(int *a,int *b)
{
int t;
t=*a;
*a=*b;
return t;
}
----------------解决方案--------------------------------------------------------
LS敢保证对吗?
----------------解决方案--------------------------------------------------------
指针
#include"stdio.h"void max(int *p,int *o)
{int t;
t=*o;
*o=*p;
*p=t;
}
----------------解决方案--------------------------------------------------------