What is a dangling pointer?

后端 未结 7 919
心在旅途
心在旅途 2020-11-22 02:48

I know this is pretty common question, but still new for me!

I don\'t understand concept of dangling pointer, was googling around, and writing test methods to find o

7条回答
  •  深忆病人
    2020-11-22 03:49

    A dangling pointer is a (non-NULL) pointer which points to unallocated (already freed) memory area.

    The above example should be correct given that the string is not modified through new_foo.

提交回复
热议问题