可能重复:
What are the differences between pointer variable and reference variable in C++?
What's the meaning of * and & when applied to variable names?
试着理解"&
“在这种情况下的含义
void af(int& g)
{
g++;
cout<<g;
}
如果你调用这个函数并传递变量名,它的行为和普通的void(int g)
一样。我知道,当你写&g
的时候,这意味着你在传递变量g
的地址。但是在这个示例中它是什么意思呢?
https://stackoverflow.com/questions/11604190
复制相似问题