void InvertList(link &head)
{
link pre,phead,temp;
phead = head->next; //将phead指向链表头的下一个结点,做游标使用
pre = NULL; //pre为头指针之前的节点
while(phead != NULL){
temp = pre;
pre = phead;
phead = phead->next;
pre->next = temp; //pre接到之前的节点
}
head->next = pre;
//这样就有头结点了 ,头结点的数据域没东西
}