diff --git a/TP/TP1/rendu/linked_list.c b/TP/TP1/rendu/linked_list.c index 0fdc670..cb57aa9 100644 --- a/TP/TP1/rendu/linked_list.c +++ b/TP/TP1/rendu/linked_list.c @@ -29,7 +29,7 @@ void insertFirst(linkedList *list, int key, void *data) { //delete first item node* deleteFirst(linkedList *list) { - if (list->head == NULL) { + if (!list->head) { return NULL; } @@ -50,7 +50,7 @@ node* find(linkedList *list, int key) { node* current = list->head; //if list is empty - if(list->head == NULL) { + if(!current) { return NULL; } @@ -58,7 +58,7 @@ node* find(linkedList *list, int key) { while(current->key != key) { //if it is last node - if(current->next == NULL) { + if(!current->next) { return NULL; } else { //go to next link @@ -78,7 +78,7 @@ node* deleteElement(linkedList *list, int key) { node* previous = NULL; //if list is empty - if(list->head == NULL) { + if(!list->head) { return NULL; } @@ -86,7 +86,7 @@ node* deleteElement(linkedList *list, int key) { while(current->key != key) { //if it is last node - if(current->next == NULL) { + if(!current->next) { return NULL; } else { //store reference to current link @@ -110,7 +110,7 @@ node* deleteElement(linkedList *list, int key) { //is list empty bool isEmpty(linkedList *list) { - return list->head == NULL; + return !list->head; } int length(linkedList *list) {