Does deleting a pointer delete the memory it's pointing too?

Viewed 9922

If I have a pointer like so:

int *test = new int;

And I create another pointer that points to test like so:

int *test2 = test;

Then I delete test2:

delete test2;

Does that mean that it will delete the memory of test as well, or would I have to call delete test also?

2 Answers
Related