X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=TP_9%2Fexo2%2Fclist.c;h=2857042028966a52133304c9bd73d23534b8c22b;hb=490c6927e0a997c48a9c21649491272b777b70d3;hp=db081179bae025aa5d7ce1e9fd14e00d266c28e2;hpb=f8051b356ef079c703c1dc0369a135b5032f4027;p=TD_C.git diff --git a/TP_9/exo2/clist.c b/TP_9/exo2/clist.c index db08117..2857042 100644 --- 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;