From d39d353b865a425a7015016632133615aeb025db Mon Sep 17 00:00:00 2001 From: Orestis <orestis.malaspinas@pm.me> Date: Wed, 11 Jan 2023 10:51:26 +0100 Subject: [PATCH] typos --- slides/cours_12.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/slides/cours_12.md b/slides/cours_12.md index 4146c0c..c9646d2 100644 --- a/slides/cours_12.md +++ b/slides/cours_12.md @@ -228,6 +228,8 @@ sorted_list sorted_list_extract(sorted_list list, int val) { # La recherche + + ```C element* sorted_list_search(sorted_list list, int val); ``` @@ -243,7 +245,7 @@ element* sorted_list_search(sorted_list list, int val) { element* pos = sorted_list_position(list, val); if (NULL == pos && val == list->data) { return list; // first element contains val - } else if (NULL != pos->next && val == pos->next->data) { + } else if (NULL != pos && NULL != pos->next && val == pos->next->data) { return pos->next; // non-first element contains val } else { return NULL; // well... val's not here @@ -277,7 +279,7 @@ element* sorted_list_position(sorted_list list, int val) { if (sorted_list_is_empty(list) || val <= list->data) { pos = NULL; } else { - while (NULL != pos->next && val > pos->next>data) { + while (NULL != pos->next && val > pos->next->data) { pos = pos->next; } } -- GitLab