struct node {
std::vector<struct node*> * list;
}
int main() {
struct node * n = new struct node;
n->list = new std::vector<struct node*>();
n->list->push_back(n);
return 0;
}
How can I delete the n->list with freeing all the pointers that the list is storing?
Will it be n->list->clear()? Or do I have to traverse n->list and call delete or free operator on each element in the list.