C语言函数里的 a,b和main函数里的a,b没有任何联系,因此功能函数里的交换并不意味着主函数里a,b的交换
#include "stdafx.h"
#include <stdio.h>void swap(int a,int b)
{
int temp;
temp=a;
a=b;
b=temp;
}
int main(int argc, char* argv[])
{
int a=2,b=3;
swap(a,b);
printf("%d %d",a,b);
return 0;
}
C语言函数里的 a,b和main函数里的a,b没有任何联系,因此功能函数里的交换并不意味着主函数里a,b的交换
#include "stdafx.h"
#include <stdio.h>