69,382
社区成员
发帖
与我相关
我的任务
分享
//下面的程序能说明问题.
#include <iostream>
using namespace std;
void foo1(int x){x = 1;}
void foo2(int& x) {x = 2;}
int main()
{
int y = 0;
foo1(y);
cout << y << endl;
foo2(y);
cout << y << endl;
return 0;
}