c语言实现单链表的倒叙
bool upsidedown_list(LinkList L) {
Lnode *head, *tmp, *oldhead;
head = L;
tmp = L->next;
oldhead = L;
while (tmp) {
oldhead->next = tmp->next;
tmp->next = head;
head = tmp;
tmp = oldhead->next;
}
return true;
}
bool upsidedown_list(LinkList L) {
Lnode *head, *tmp, *oldhead;
head = L;
tmp = L->next;
oldhead = L;
while (tmp) {
oldhead->next = tmp->next;
tmp->next = head;
head = tmp;
tmp = oldhead->next;
}
return true;
}