I am learning about references in C++. So i am trying out different examples to better understand the concept. One example that i could not understand is given below:
double val = 4.55;
const int &ref = val;
std::cout << ref <<std::endl; //prints 4 instead of 4.55
I want to know what is the problem and how can i solve it?
Aucun commentaire:
Enregistrer un commentaire