#include"linklist.h"
int main()
{
linklist *L;
ElemType a[]= {1,3,5,7, 2,4,8,10};
CreateListR(L,a,8);
printf("L:");
DispList(L);
Reverse(L);
printf("逆置后L: ");
DispList(L);
DestroyList(L);
return 0;
}
</pre><pre name="code" class="html">
</pre><pre name="code" class="html"> void Reverse(linklist *l)
{
linklist *p,*q;
p=l->next;
l->next=NULL;
while(p!=NULL)
{
q=p->next;
p->next=l->next;
l->next=p;
p=q;
}
}