int *ptr = 0; int &ref = *ptr; I write above code in Visual Studio and it works? Here I am pointing to NULL. Why it is allowed? Pointer can take any address, NULL or even invalid address. Still reference to indirection of pointer is allowed?
Then why it is said "Reference cannot be null." Here, is reference not pointing to NULL?
*ptrcauses undefined behavior.