C++ Programming - References - Discussion

Discussion Forum : References - General Questions (Q.No. 1)
1.
Which of the following statement is correct?
A reference is stored on heap.
A reference is stored on stack.
A reference is stored in a queue.
A reference is stored in a binary tree.
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
25 comments Page 3 of 3.

Naresh said:   1 decade ago
In c++ references are stored in stack surely.
When we talk about reference in java, it places Heap area.

Praphulla said:   1 decade ago
Reference is one type of variable stored on stack because of there is need to perform operation on them where object stored on heap.

Valsala shukla said:   1 decade ago
References is like pointers and pointers stores address so I think that's why references are stored on stack.

Saurabh said:   1 decade ago
Actually cpp uses Reference model for user defined data types (like classes, enum etc) , so when a reference is created then actually no object is created in fact reference points to heap object and it is (reference) stored on stack.

Amit said:   1 decade ago
How can we say that, A reference is stored on stack. . ?
I think, Reference has no memory. It just an another name of variable.
Can anyone tell me. . ?
(1)


Post your comments here:

Your comments will be displayed after verification.