RELATEED CONSULTING
相关咨询
选择下列产品马上在线沟通
服务时间:8:30-17:00
你可能遇到了下面的问题
关闭右侧工具栏

新闻中心

这里有您想知道的互联网营销解决方案
C语言反转单向链表的代码

学习过程中中,把内容过程中常用的内容片段做个珍藏,下边内容段是关于C语言反转单向链表的内容,应该能对大伙有较大用处。

我们提供的服务有:成都做网站、成都网站制作、成都外贸网站建设、微信公众号开发、网站优化、网站认证、忻城ssl等。为上1000家企事业单位解决了网站和推广的问题。提供周到的售前咨询和贴心的售后服务,是有科学管理、有技术的忻城网站制作公司

#include "stdafx.h"

enum{N = 3};
class Node
{
public:
int var;
Node(int i):pNext(NULL), var(i){}
};

{
if(pHead->pNext->pNext != NULL)
helper(pHead->pNext, reverseHead);
else
reverseHead = pHead->pNext;
pHead->pNext->pNext = pHead;
}

{
if(NULL == pHead || NULL == pHead->pNext)
return NULL;

helper(pHead, reverseHead);
pHead->pNext = NULL;
return reverseHead;

}

{
if(NULL == pHead || NULL == pHead->pNext)
{
return NULL;
}

if(NULL == N2)
{
    N1->pNext = pHead;
    pHead->pNext = NULL;
}
else
{
    while (NULL != N2)
    {
        N1->pNext = pHead;
        pHead = N1;
        N1 = N2;
        N2 = N2->pNext;
    }
    N1->pNext = pHead;
    t->pNext = NULL;
}

return N1;

}

{
while (pHead != NULL)
{
printf("%d ",pHead->var);
pHead = pHead->pNext;
}
printf("rn");
}

void Test()
{
for(int i = 1; i < N; i++)
{
pNode->pNext = pNext;
pNode = pNode->pNext;
}
PrintNode(pHead);
PrintNode(reversedHead);

}

{
Test();
return 0;
}


网页题目:C语言反转单向链表的代码
文章URL:http://sczitong.cn/article/pichgj.html