class node {
public:
int data;
node *next;
node *prev;
node(int d) {
this->data = d;
this->next = NULL;
this->prev = NULL;
}
~node() {
int value = this -> data;
if (next != NULL) {
delete next;
next = NULL;
}
cout << "memory free for node with data " << value << endl;
}
};
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter