Because references always “point” to valid objects, and can never be pointed to deallocated memory, references are safer to use than pointers.
Can anyone give an example of this? this doesnt make sense. couldn't you just do
int& function()
{
int variable = 3;
return variable&;
}
looks deallocated to me? how are they referring to references being safe?