dangling pointer in cpp

Solutions on MaxInterview for dangling pointer in cpp by the best coders in the world

showing results for - "dangling pointer in cpp"
June
06 Oct 2019
1int *p = new int; // request memory
2*p = 5; // store value
3
4delete p; // free up the memory
5// now p is a dangling pointer
6
7p = new int; // reuse for a new address