引用函数声明的位置会影响到主函数?
#include <iostream>
using namespace std;
void swap(int&,int&);//如果放在里面声明就不行了!为何 ?
int main( )
{
int i=3,j=5;
cout<<"交换前:"<<endl;
cout<<"i="<<i<<" "<<"j="<<j<<endl;
swap(i,j);
cout<<"交换后:"<<endl;
cout<<"i="<<i<<" "<<"j="<<j<<endl;
return 0;
}
void swap(int&a, int&b) //形参是引用类型
{
int temp;
temp=a;a=b;b=temp;
}
___