From 761e3496a6d0b43ff9da57c458032abc83f8ae8c Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Wed, 8 Mar 2017 15:00:11 +0100 Subject: [PATCH] TP 11 exo2: avoid a function run at each for() loop iteration 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 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TP_11/exo2/ui.c b/TP_11/exo2/ui.c index 7599780..b8233b5 100644 --- a/TP_11/exo2/ui.c +++ b/TP_11/exo2/ui.c @@ -18,7 +18,7 @@ void displayArray(const int array[], unsigned length) { void displayList(link_t* head) { printf("--Begin--\n"); - for (unsigned i = 0; i < list_count(head); i++) { + for (unsigned i = 0, length = list_count(head); i < length; i++) { printf("value at [%d]=%d\n", i, list_get(head, i)); } printf("--End--\n"); -- 2.34.1