#include
#include
typedef struct _LinkList
{
struct _LinkList *next;
} LinkList;
LinkList* ReverseList_L(LinkList *head)
{
LinkList *prior, *cur, *next, *temp;
prior = NULL;
cur = head;
next = head->next;
while (next != NULL)
{
cur->next = prior;
temp = next->next;
next->next = cur;
prior = cur;
cur = next;
next = temp;
}
return cur;
}
int main(void)
{
LinkList n1, n2, n3, n4;
n1.next = &n2;
n2.next = &n3;
n3.next = &n4;
n4.next = NULL;
ReverseList_L(&n1);
return 0;
}
为什么最近这么多人问这个?难道都是一个学校的?
http://www.cnblogs.com/aceofspades/archive/2008/10/05/1304056.html
链表和栈给出来了么,还是要自己写代码定义