您的位置:首页 > 编程语言 > C语言/C++

C++引用的使用

2016-04-07 12:13 253 查看
#include <iostream>
using namespace std;

void swapValue(int &x, int &y)
{
int temp;
temp = x;
x = y;
y = temp;
}

int main()
{
int v1 = 3;
int v2 = 6;

cout << v1 << " " << v2 << endl;
swapValue(v1, v2);
cout << v1 << " " << v2 << endl;

return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: