美国老土真不土,学问肚中涨鼓鼓。改行专业搞科研,育人顺便赚大钱! 这个得赞,大赞!!!有个问题想请教,见内。

来源: 2019-01-22 21:01:37 [博客] [旧帖] [给我悄悄话] 本文已被阅读:

想把x和y换一下, 下面的code哪里有问题,我今天想呀想,嗯, 人老了,就是不行了,只有耍点老得不老的东西。 麻烦代劳。 

#include <stdio.h>  

// This function swaps values of xp and yp
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";
}