Does delete n_ptr delete the memory n_ptr is pointing to?
What does "delete the memory" mean?
It causes the destructor function of the object it points at to run, and tells the operating system that you no longer care what happens with the memory that object occupies. That's all it does.
When we do this: delete n_ptr are we decoupling the pointer from the address it is pointing to? I also didn't know you could destroy an object by deleting its pointer.
Finally, if I want to use n_ptr again, I'm getting a redeclaration error even though deletion has occurred and object deleted. Any way to recycle?
When we do this: delete n_ptr are we decoupling the pointer from the address it is pointing to?
Before you call delete, n_ptr points at some piece of memory. After you call delete, n_ptr is completely, 100% unchanged. It is identical to how it was before. It will be pointing at the exact same memory address it was before.
Finally, if I want to use n_ptr again, I'm getting a redeclaration error even though deletion has occurred and object deleted. Any way to recycle?