作者在 2010-04-06 13:39:53 发布以下内容
swap(int *a,int *b)
{
int t;
printf("(2)*a=%d *b=%d\n",*a,*b);
t=*a;
*a=*b;
*b=t;
printf("(3)*a=%d *b=%d\n",*a,*b);
}
main()
{
int x=20,y=30;
printf("(1)x=%d y=%d\n",x,y);
swap(&x,&y);
printf("(4)x=%d y=%d",x,y);
getch();
}
{
int t;
printf("(2)*a=%d *b=%d\n",*a,*b);
t=*a;
*a=*b;
*b=t;
printf("(3)*a=%d *b=%d\n",*a,*b);
}
main()
{
int x=20,y=30;
printf("(1)x=%d y=%d\n",x,y);
swap(&x,&y);
printf("(4)x=%d y=%d",x,y);
getch();
}