gpt4 book ai didi

c++ - int &f = d 是什么意思

转载 作者:行者123 更新时间:2023-11-28 07:54:27 25 4
gpt4 key购买 nike

<分区>

Possible Duplicate:
References in C++
What does int & mean

我很难理解以下代码中的语句 int &f = d。如果有人能解决这个问题,我将不胜感激

int main()
{
int d = 13 ;
int &f = d ;
std::cout << f;
}

编辑:我熟悉引用文献的概念抱歉我没有提供足够的背景知识。我知道如果我做这样的事情

int a = 12
std::cout << &a //this gives the address of a and not the content of the address which is 12

现在我的问题是 int &f = d 对我来说问题是f 似乎需要一个地址,而 d 给它一个值而不是地址。

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com