+ 1
Why we cannot store null into reference in c++?
i want to know why we can not store null in reference ,even though it is a pointer internally.
3 Respuestas
+ 2
if a pointer can store null and if reference acts as a pointer internally then why it cant store null ? i know there is no use of it but still needs to clear my doubts
+ 2
rushi joshi Because the compiler makes sure, at compile-time, that you don't assign a null to a reference.
+ 1
Why don't you reverse the question? What would be the use of storing null in a reference?