codice:int increase_delete(struct elemento **l, int soglia) { int count = 0; struct elemento *tmp; while((*l)!=NULL) { if(++((*l)->value) > soglia) { tmp = (*l); (*l) = (*l)->next; free(tmp); ++count; continue; } else { break; } } if((*l) == NULL) { return count; } struct elemento *ls = *l; while(ls->next != NULL) { if(++(ls->next->value)>soglia) { tmp = ls->next; ls->next = ls->next->next; free(tmp); ++count; } } return count; }

Rispondi quotando