repositories
/
TD_C.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
f8051b3
)
TP 9 exo2: Simplify the return value handling in the list counting
author
Jérôme Benoit
<jerome.benoit@piment-noir.org>
Wed, 1 Mar 2017 07:59:51 +0000
(08:59 +0100)
committer
Jérôme Benoit
<jerome.benoit@piment-noir.org>
Wed, 1 Mar 2017 07:59:51 +0000
(08:59 +0100)
function.
Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
TP_9/exo2/clist.c
patch
|
blob
|
blame
|
history
diff --git
a/TP_9/exo2/clist.c
b/TP_9/exo2/clist.c
index db081179bae025aa5d7ce1e9fd14e00d266c28e2..2857042028966a52133304c9bd73d23534b8c22b 100644
(file)
--- a/
TP_9/exo2/clist.c
+++ b/
TP_9/exo2/clist.c
@@
-32,9
+32,10
@@
link_t* list_prepend(link_t* head, int value) {
}
unsigned list_count(link_t* head) {
- int count =
1
;
+ int count =
0
;
- if (head == NULL) { return 0; }
+ if (head == NULL) { return count; }
+ count = 1;
while (head->next != NULL) {
++count;
head = head->next;