Are references stored on the heap or stack?

c++, memory-management, reference

Solution

A reference is just an alias, and it is unspecified by the C++11 Standard whether it requires actual storage or not.

Per Paragraph 8.3.2/4 of the C++11 Standard:

It is unspecified whether or not a reference requires storage (3.7).

Problem

I wonder whether the reference variables such as `c` in this code: ``` int a = 5; int & c = a; ``` are allocated from heap or stack. Can anyone help? Thanks

Original source

Related problems