C实现交换两个变量
Linux 2015/2/21 13:52:37  点击:不统计
http://%77%77%77%2E%66网站制作%6F学习网%72%61%73%70%2E%63%6E
 采用第三个变量形式
#include<stdio.h>
int test1_8(){
    int a,b,t;
    scanf("%d%d",&a,&b);
    t = a;
    a = b;
    b = t;
    printf("a = %d b = %d",a,b);
    return 0;
}
#include<stdio.h>
int test1_9(){
    int a,b;
    scanf("%d%d",&a,&b);
    a = a+b;
    b = a - b;
    a = a - b;
    printf("a = %d,b=%d",a,b);
    return 0;
}
#include<stdio.h>
int main(){
    //test1_8();
    test1_9();
}
