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 cannot assign a constant value to a non-constant reference, the same way you could not assign a constant value's address to a pointer pointing to a non-constant value.
At least, not without a const_cast.
Edit: If you were actually referring to literal values, Luc's answer is the better one. I was referring to const variables, not literals.