I am having a hard time figuring out why my delete function is not working. It is a boolean that needs to return if an item was deleted. Any help would be appreciated
boolean delete(SLL *list, String str){
NODE *current, *previous,*temp;
temp=malloc(sizeof(Employee));
previous=NULL;
current = list -> head;
while(current->next!=NULL) {
if(strcmp(current->anEmployee->name, str) == 0){
if(current=list->head){
list->head=current->next;
}
if(previous->next == NULL){//item not found in list
return 0;
}
else { //current is to be deleted
temp->next=current->next;
previous->next=temp->next;
return 1;
}
}
}