When we use delete
for a pointer
(delete p;
), and don't use nullptr
for it then, it points to some else location in memory. Can that new location have a valid value so that we can use it in the code?
Whether a pointer points to the same location or a different location after it has been delete
d is not specified by the language. An implementation is free to do whatever they wish to do with the value of that pointer.
Can that new location have a valid value so that we can use it in the code?
That's up to your code. The compiler is not required to do so.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With