引用不是创建一个新的变量,而是给已经存在的变量起一个“别名”,使用引用的时候相当于直接使用原变量。 引用传递 void fun(int& x) { x++; } int main() { int a=10; fun(a); std::cout<<a<<std::endl;//a=11 }