Risolto. Posto se a qualcuno dovesse servire qualcosa di simile.
Ci ho messo tutto sto tempo per risolvere questa dannata funzione.codice:int increase_delete( struct elemento **lista, int N, int thres){ int count=0; if( *lista == NULL) return 0; if( ++(*lista)->value > thres ){ while ( (*lista)->next != NULL ){ struct elemento *copied = *lista; while ( copied->next->next != NULL ){ copied = copied->next; } free ( copied->next ); copied->next=NULL; //per sicurezza } free (*lista); *lista = NULL; return N-1; } while ( (*lista)->next != NULL && ++(*lista)->next->value <= thres){ //++(*lista)->value; *lista = (*lista)->next; count++; } while ( (*lista)->next != NULL ){ struct elemento *copied = *lista; while ( copied->next->next != NULL ){ copied = copied->next; } free ( copied->next ); copied->next=NULL; //per sicurezza } return (N-count-1); }

Rispondi quotando