链表反转主体代码
//链表逆序
bool reverse_linklist(struct node *ph){
struct node *pbefore=NULL,*pafter,*pcur=NULL;
pbefore=ph;
pcur=ph->next;
if(pcur==NULL)
return false;
while(pcur!=NULL){
pafter=pcur->next;
//当前的下一个节点指向现在前面一个,
pcur->next=pbefore;
pb.
原创
2022-03-23 21:53:04 ·
91 阅读 ·
1 评论