想把x和y换一下, 下面的code哪里有问题,我今天想呀想,嗯, 人老了,就是不行了,只有耍点老得不老的东西。 麻烦代劳。
#include <stdio.h>
void swap(int xp, int yp)
{
int temp = xp;
xp = yp;
yp = temp;
}
int main()
{
int x, y;
printf("Enter Value of x ");
scanf("%d", &x);
printf("\nEnter Value of y ");
scanf("%d", &y);
swap(x, y);
printf("\nAfter Swapping: x = %d, y = %d";
}
|