H
hal22
Hello, I have a problem deleting lists. The function delete_all will
delete a complete list, starting with the entry given as parameter.
delete_one deletes one element of a list and returns the next. I want
to make these functions bullet proof, but it seems that I don't get
how to set the parameter to NULL after freeing the contents.
Lets say I have a list "
void delete_all( Monom* monom ){
while( monom != NULL ){
monom = delete_monom( monom );
}
}
static Monom*
delete_one( Monom* monom){
Monom *temp = monom->next;
free( monom );
monom = NULL;
return temp;
}
delete a complete list, starting with the entry given as parameter.
delete_one deletes one element of a list and returns the next. I want
to make these functions bullet proof, but it seems that I don't get
how to set the parameter to NULL after freeing the contents.
Lets say I have a list "
void delete_all( Monom* monom ){
while( monom != NULL ){
monom = delete_monom( monom );
}
}
static Monom*
delete_one( Monom* monom){
Monom *temp = monom->next;
free( monom );
monom = NULL;
return temp;
}