In some text it is given that we can\'t assign constant values to a reference variable. When I executed such a program I could do it. Is there any condition we can\'t assign
You can initialize a constant reference to a constant value.
const int &i = 12;
If the reference is not const, you get a compiler error.
int &i = 12; //compiler error
Constant values (e.g. literals) are (most of the time) stored in read-only segments of the memory. Consequently, you can't reference them using non-const references, because that would mean you could modify them.