引用的基本使用
int main() { // 给变量起别名 //语法 数据类型 &别名 = 变量名 int a = 10; int &b = a; cout << "a " << a << endl; cout << "b " << b << endl; b = 100; cout << "a1 " << a << endl; cout << "b1 " << b << endl; return 0; }
输出结果:
a 10
b 10
a1 100
b1 100
标签:10,变量,int,别名,C++,100 From: https://www.cnblogs.com/itniwota/p/16852574.html