repositories
/
TD_C.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
TP11 exo2: Respect the specification for displayList() function
[TD_C.git]
/
TP_11
/
exo2
/
ui.c
diff --git
a/TP_11/exo2/ui.c
b/TP_11/exo2/ui.c
index 998b8469cb4a45fbb503e8ca895b1b0d49e508fd..7599780b4a88f37ade741213b249de17eca19ba0 100644
(file)
--- 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) {
}
void displayList(link_t* head) {
- unsigned i = 0;
-
printf("--Begin--\n");
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");
}
}
printf("--End--\n");
}