+ 7
Reference variables ? 😶
Can anyone say about what are the differences between pass by value , pass by reference and pass by pointers ?
14 ответов
+ 16
In call by value a copy of the variable is passed .
Where as in call by reference a variable itself is passed.
And in call by pointer can be re assigned any number of time while a reference cannot be reassigned after binding .
And you can take the address of reference in call by pointer where it is not in reference.
+ 4
A reference variable is a special type of variable which stores the address of another variable...
so when we use call by value
the main() and the calling() both have separate memory location which increases the memory overhead
but while using pass by reference all operations take place on one memory locations for which the wastage of extra memory is reduced...
and if a reference variable is passed the function should posses a pointer parameter in order to hold it.
+ 4
Value = direct assignment
Reference - uses indirection - more memory intensive 🧔
+ 3
Maybe the question has been asked here before? You could also search for previous questions and answers.
+ 1
Ryuga[#RIP]
You are talking about pointer variable..
Reference variable are different from pointer variable..
Pointer variable do have different memory location while reference variable works on same memory as variable it is alias to..
(I think you are confused between this two!!)
+ 1
AnonymousGuy these three harass every known programmer some time or the other 😂
+ 1
Ryuga[#RIP] Thank you 👍
+ 1
~ swim ~ Thanks for your advise 👍😊
+ 1
Paolo De Nictolis Thank you 👍
0
Ryuga[#RIP]
Correct..😂😂😂
0
Rohit Gupta Thank you 👍
0
Sonic Thank you 👍
0
Sanjay Kamath thank you 👍