+ 2

Please explain me reference counting in easy language

30th Jun 2017, 8:03 AM
Mrityunjay Jha
Mrityunjay Jha - avatar
2 Respuestas
0
No reference: void function(bool x) { x = true; } int main() { bool reference = false; function(reference); //&reference != &x cout << reference; //false } Reference: void function(bool& x) { x = true; } int main() { bool reference = false; function(reference); //&reference == &x cout << reference; //true } With a reference, function arguments are not copied. Do you have questions about this?
9th Aug 2017, 2:09 PM
Timon Paßlick
0
nope
22nd Nov 2017, 4:36 PM
Mrityunjay Jha
Mrityunjay Jha - avatar