定义一个节点结构:
struct node
{
int date;//可能使用其它类型或结构
node *next;
};
假设你的链表已经存在,为L
node *curnode = L;//当前节点,指向开始
node *temp=curnode->next;//临时节点
curnode->next=NULL;
L=curnode;
//先将指针指向队尾
while(temp != NULL)
{
curnode=temp;
temp =curnode->next;
curnode->next=L;
L=curnode;
}