我想问一下&和*的作用有些什么?
#include<iostream>using namespace std;
void change(int a, int b)
{
int tem;
tem = a;
a = b;
b = tem;
}
int main()
{
int a = 2,b = 8;
change(a,b);
cout<<a<<'\n'<<b<<endl;
system("pause");
return 0;
}不能实现交换,但改成void change(int &a, int &b)就行了;
还有友元里面的&也不懂!