Consider the following code:
This outputs: 20 100 90Code:const int con = 100; int &ref1 = 10; //Where is this 10 stored? int &ref2 = con; ref1 = 20; ref2 = 90; cout<<ref1<<con<<ref2;
My only queries are:
a) Where is the hard coded number 10 stored?
b) When ref1 is modified which memory was modified? (10's or ref1 has it's own memory)
c) Why was const variable not modified but somehow it's reference was?
Regards,
Nisheeth Barthwal




Reply With Quote