From ecef2540bc4459b89e9619ad159783da6015759e Mon Sep 17 00:00:00 2001 From: augustin64 Date: Sun, 31 Mar 2024 18:26:34 +0200 Subject: [PATCH] TP1: Presentation --- TP/TP1/rendu/linked_list.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) 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) {