分享到:
发表于 2015-12-13 18:36:36 楼主 | |
大神求教,问题在第三行 #include using namespace std; 2 void swap(int& a, int& b) 为什么形参需要进行取地址运算才可以实现交换功能 ?? 3 { 4 int temp = a; 5 a = b; b = temp; } int main() { void swap(int&, int&); int t1 = 1, t2 = 2; cout << t1 << 't' << t2 << 'n'; swap(t1, t2); cout << t1 << 't' << t2; system("pause"); } |
|
楼主热贴
个性签名:无
|
针对ZOL星空(中国)您有任何使用问题和建议 您可以 联系星空(中国)管理员 、 查看帮助 或 给我提意见