The book "Data Structures in C" (Horowitz and Sahni) suggests that in the following code the pointer pf is behaving as a dangling reference:
float f,*pf;
pf=(float*) malloc(sizeof(float));
*pf=2.6;
pf=(float*) malloc(sizeof(float));
The reasoning they give is that after the last line there is no way to retrieve the storage in which 2.6 was stored.
However, wikipedia defines a dangling pointer as
Dangling pointers and wild pointers in computer programming are pointers that do not point to a valid object of the appropriate type
In the code above pf does not satisfy that definition - it points to a valid object of appropriate type.
Is pf a dangling pointer, or something else?