Dangling pointer points address of freed memory? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Dangling pointer points address of freed memory?

Then what way we can use dangling pointer?

27th Jul 2019, 4:32 PM
Mithilesh Kumar
Mithilesh Kumar - avatar
2 Answers
+ 4
U can assign new address to reuse the same pointer variable, instead of declaring a new pointer variable if you need. Hope this helps...!!!
27th Jul 2019, 4:53 PM
Kuri
Kuri - avatar
+ 2
A good practice I use it to set the dangling pointer to null after I free the memory. You can always set it to a different memory address like Kuri said too.
28th Jul 2019, 5:07 AM
Zeke Williams
Zeke Williams - avatar