From 198615555e53390f89cab08e27faaaeb42c2ee6e Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Tue, 7 Mar 2017 20:40:32 +0100 Subject: [PATCH] TP11 exo2: Respect the specification for displayList() function MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- TP_11/exo2/ui.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/TP_11/exo2/ui.c b/TP_11/exo2/ui.c index 998b846..7599780 100644 --- a/TP_11/exo2/ui.c +++ b/TP_11/exo2/ui.c @@ -17,13 +17,9 @@ void displayArray(const int array[], unsigned length) { } void displayList(link_t* head) { - unsigned i = 0; - printf("--Begin--\n"); - while (head != NULL) { - printf("value at [%d]=%d\n", i, head->value); - head = head->next; - i++; + for (unsigned i = 0; i < list_count(head); i++) { + printf("value at [%d]=%d\n", i, list_get(head, i)); } printf("--End--\n"); } -- 2.34.1