不知这段代码中c
等引用变量是否:
int a = 5;
int & c = a;
从堆或栈中分配。 谁能帮忙?谢谢
最佳答案
引用只是一个别名,C++11 标准未指定它是否需要实际存储。
根据 C++11 标准的第 8.3.2/4 段:
It is unspecified whether or not a reference requires storage (3.7).
关于c++ - 引用是存储在堆上还是栈上?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15486052/