c语言中的&运算符做形参相关
#include<iostream.h>
#include<stdio.h>
voidswap(int &x,int &y);
intmain()
{
inta=10;
intb=5;
swap(a,b);
cout<<a<<""<<b<<endl;
getchar();
}
voidswap(int &x,int &y)
{
x=55;
y=55;
}
输出55 55
为无为,事无事 / 天下难事,必作于易
#include<iostream.h>
#include<stdio.h>
voidswap(int &x,int &y);
intmain()
{
inta=10;
intb=5;
swap(a,b);
cout<<a<<""<<b<<endl;
getchar();
}
voidswap(int &x,int &y)
{
x=55;
y=55;
}
输出55 55