Skip to content
Snippets Groups Projects
Commit f14a657e authored by leo.muff's avatar leo.muff
Browse files

init

parent a3f220d0
No related branches found
No related tags found
No related merge requests found
File deleted
...@@ -193,13 +193,17 @@ int dll_pop(dll_t *list){ ...@@ -193,13 +193,17 @@ int dll_pop(dll_t *list){
} }
else{ else{
free(list->tete); free(list->tete);
list->tete = NULL;
} }
return val; return val;
} }
// vide la liste // vide la liste
void dll_destroy(dll_t *list){ void dll_destroy(dll_t *list){
assert(!dll_is_empty(*list));
while(!dll_is_empty(*list)){
dll_pop(list);
}
} }
...@@ -227,5 +231,7 @@ int main(){ ...@@ -227,5 +231,7 @@ int main(){
val = dll_pop(&list); val = dll_pop(&list);
printf("%d popped from dll\n",val); printf("%d popped from dll\n",val);
dll_print(list); dll_print(list);
dll_destroy(&list);
printf("destroying the list, empty :%d\n",dll_is_empty(list));
return 0; return 0;
} }
\ No newline at end of file
File deleted
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment