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 1 of 3.

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)

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.

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.

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.

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

Arpita sahoo said:   1 decade ago
What is constant?

Mahesh Hirpara said:   1 decade ago
What say not possible reference stored on stack ? when it possible?

Muhammad Qamar Saleem said:   1 decade ago
References store address of objects and only refer to objects. They are used only as a pointer.

Sunil brahmajosyula said:   1 decade ago
@valsala shukla.

Even pointers should be stored in queue?

Bindu said:   1 decade ago
Reference type stored in heap not stack.
(1)


Post your comments here:

Your comments will be displayed after verification.