#include<iostream>
using namespace std;
int main()
{
int a = 0;
int d = 1;
//注意:
//1.引用必须要初始化
//int& b;//出错
//2.引用一旦初始化,就不可以更改
int& c = a;
c = d;//赋值操作,而不是更改引用
cout << "a=" << a << endl;
cout << "c=" << c << endl;
cout << "d=" << d << endl;
system("pause");
return 0;
}
网友评论