loop to perform operations to remove key to end
while ( current != tail ) { if ( current -> data == key && prev2 == NULL ) { prev = current ; current = current -> next ; head = current ; last -> next = prev ; last = last -> next ; last -> next = NULL ; prev = NULL ; } else { if ( current -> data == key && prev2 != NULL ) { prev = current ; current = current -> next ; prev2 -> next = current ; last -> next = prev ; last = last -> next ; last -> next = NULL ; } else if ( current != tail ) { prev2 = current ; current = current -> next ; } } } return head ; }