خرید بک لینک

Vote count: 0

Here is what I've done so far:

struct rep_list {
    struct node *head;
    struct node *tail;
}

typedef rep_list *list;

int length(const list lst) {
    if (lst->head == NULL) {
        retu 0;
    }
    else {
        lst->head = lst->head->next;
        retu 1 + length(lst);
    }
}

This works, but the head of the list the function accepts as a parameter gets changed. I don't know how to fix that.

I'm not allowed to change the function definition so it should always accept a list variable.

Any ideas?

asked 1 min ago

برچسب: نویسنده: استخدام کار تاريخ: شنبه 21 فروردين 1395 ساعت: 6:10

صفحه بندی