+ 7

Reference variables ? 😶

Can anyone say about what are the differences between pass by value , pass by reference and pass by pointers ?

2nd Sep 2019, 1:11 PM
Chamil Sachintha
Chamil Sachintha - avatar
15 Respuestas
+ 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.
2nd Sep 2019, 1:38 PM
Rohitman
Rohitman - avatar
+ 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.
2nd Sep 2019, 6:57 PM
Aditya
Aditya - avatar
+ 4
Value = direct assignment Reference - uses indirection - more memory intensive 🧔
3rd Sep 2019, 2:56 AM
Sanjay Kamath
Sanjay Kamath - avatar
+ 3
Maybe the question has been asked here before? You could also search for previous questions and answers.
3rd Sep 2019, 3:09 AM
Sonic
Sonic - avatar
+ 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!!)
3rd Sep 2019, 2:36 AM
Alaska
Alaska - avatar
+ 1
AnonymousGuy these three harass every known programmer some time or the other 😂
3rd Sep 2019, 4:00 AM
Aditya
Aditya - avatar
+ 1
Ryuga[#RIP] Thank you 👍
4th Sep 2019, 12:30 PM
Chamil Sachintha
Chamil Sachintha - avatar
+ 1
~ swim ~ Thanks for your advise 👍😊
4th Sep 2019, 12:31 PM
Chamil Sachintha
Chamil Sachintha - avatar
+ 1
Paolo De Nictolis Thank you 👍
4th Sep 2019, 12:32 PM
Chamil Sachintha
Chamil Sachintha - avatar
0
Ryuga[#RIP] Correct..😂😂😂
3rd Sep 2019, 8:15 AM
Alaska
Alaska - avatar
0
Rohit Gupta Thank you 👍
4th Sep 2019, 12:30 PM
Chamil Sachintha
Chamil Sachintha - avatar
0
Sonic Thank you 👍
7th Sep 2019, 9:22 AM
Chamil Sachintha
Chamil Sachintha - avatar
0
Sanjay Kamath thank you 👍
7th Sep 2019, 9:22 AM
Chamil Sachintha
Chamil Sachintha - avatar