Dangling pointer

Applies to: cpp, c

A dangling pointer points to an object whose lifetime has ended. Dereferencing it is undefined behavior.

int* p;
{ int x = 1; p = &x; }
// p is dangling here

See also: pointer, raii