I apologize if this is too basic of a question or if it is common - I searched here as well as on Google with no luck.
I am trying to delete a node in a binary tree, but the delete operator seems to be doing nothing.
Here is my node:
struct node {
node(int value) : left(NULL), right(NULL), quantity(1) { val = value; }
int val;
int quantity;
node* left;
node* right;
}
And my test code:
node* test = new node(15);
cout<<test<<'\n'; //Outputs memory address
cout<<test->val<<'\n'; //Outputs 15
delete test;
cout<<test<<'\n'; //Outputs same memory address
cout<<test->val<<'\n'; //Outputs 15
Any help is much appreciated! I peeked at the documentation and didn't see anything about bulk memory cleanups that would indicate to me it'll be cleared later.