函数声明问题
![](zzz/editor/img/code.gif)
#include<iostream> using namespace std; void swap(int &a,int &b); main() { int r = 5, t = 6; swap(r,t); cout<<"r:"<<r<<" t:"<<t<<endl; } void swap(int &a,int &b) { int temp = a; a = b; b = temp; }
![](zzz/editor/img/code.gif)
#include<iostream> using namespace std; main() { void swap(int &a,int &b); int r = 5, t = 6; swap(r,t); cout<<"r:"<<r<<" t:"<<t<<endl; } void swap(int &a,int &b) { int temp = a; a = b; b = temp; }
这两段代码的结果怎么不一样呢