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 2 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)

Harish said:   5 years ago
The reference is stored in a stack while the object is allocated in the heap. Instances or references of a value type are stored in the stack.
(1)

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.

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

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

Ramesh said:   1 decade ago
Reference is also a variable declared in a function. That should be stored in stack.

Velmurugan said:   1 decade ago
Reference is a variable&data declaration part in your program. (i.e int a =6).

Rajendra said:   8 years ago
ref in cpp is treated as constant pointer.

<type>* const <ptr>;

Vasanth anderson said:   7 years ago
A reference variable is the "alias name" to the existing data type variable.
(1)


Post your comments here:

Your comments will be displayed after verification.