Reference variables ? 😶
Can anyone say about what are the differences between pass by value , pass by reference and pass by pointers ?
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.
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.
Value = direct assignment Reference - uses indirection - more memory intensive 🧔
Maybe the question has been asked here before? You could also search for previous questions and answers.
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!!)
AnonymousGuy these three harass every known programmer some time or the other 😂
Ryuga[#RIP] Thank you 👍
~ swim ~ Thanks for your advise 👍😊
Paolo De Nictolis Thank you 👍
Rohit Gupta Thank you 👍
Sonic Thank you 👍
Sanjay Kamath thank you 👍