From: Jérôme Benoit Date: Wed, 8 Mar 2017 14:00:11 +0000 (+0100) Subject: TP 11 exo2: avoid a function run at each for() loop iteration X-Git-Url: https://git.piment-noir.org/?p=TD_C.git;a=commitdiff_plain;h=761e3496a6d0b43ff9da57c458032abc83f8ae8c TP 11 exo2: avoid a function run at each for() loop iteration Signed-off-by: Jérôme Benoit --- 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");