Hello,
I've written a delete function to delete any integer value based on in parameter. The problem I have now is that this function deletes the values, but leaves the Node position intact with some huge int value instead.
So my question is, do I need to rearrange the Node, or why doesn't a simply delete works?
e.g. the node contains
1, 2, 3, 4, 5
and I delete '4' output becomes
1, 2, 3, 4130880, 5
void Set::del (int value) {
Node *temp = header;
while(temp->next != 0 && temp->value != value) {
temp = temp->next;
}
if(temp->value == value) {
delete temp;
}
}