I dont know whats wrong with my code. Also, how would you delete a node in the linked list.
for( IntNode* i = head; i != 0; i = i->next ) {
IntNode* prev = i;
for( IntNode* j = i->next; j != 0; j = j->next ) {
if( j->data == i->data ) {
IntNode* temp = j;
prev->next = j->next;
delete temp;
}
prev = prev->next;
}
}
Aucun commentaire:
Enregistrer un commentaire