Reading http://www.cprogramming.com/tutorial/references.html, it says:
In general, references should always be valid because you must always initi
Because by the time you reach there you have made an undefined behavior for sure. Let me explain :)
Say you have:
void fun(int& n);
Now, if you pass something like:
int* n = new int(5);
fun(*n); // no problems until now!
But if you do the following:
int* n = new int(5);
...
delete n;
...
fun(*n); // passing a deleted memory!
By the time you reach fun, you will be dereferencing *n which is undefined behavior if the pointer is deleted as in the example above. So, there is no way, and there must be now way actually because assuming valid parameters is the whole point of references.