void evenodd(node*&head){
node*temp=head;
while(temp->next !=NULL){
if(temp->next->data %2==1){
node*todelete=temp->next;
int da=temp->next->data;
if(temp->next->next !=NULL){
temp->next=temp->next->next;
}
else{
temp->next = NULL;
}
delete todelete;
insertAthead(head,da);
}
temp=temp->next;
}
}
Why it is not working for the last elemet