求助 c 语言链表,我哪里错了, vc++6.0 好弱智不显示行号

2015-12-13 21:38:52 +08:00
 tangsir
# include <stdio.h>
# include <malloc.h>
# include <stdlib.h>

struct Node
{
int data;
struct Node * pNext;
};

struct Node *creat_list(void);
void traverse_list(struct Node *);

int main(viod)
{
struct Node * pHead = NULL;

pHead = creat_list();
traverse_list(pHead);

return 0;
}

struct Node * creat_list()
{
int i;
int val;
int length;

printf("请输入链表长度:");
scanf("d%",&length);

struct Node * pHead = (struct Node *)malloc(sizeof(struct Node)) ;
struct Node * pTail = pHead;
pTail->Next = NULL;//分配一个空头文件完成,尾部指向为空

for (i=0;i<length;++i)
{
printf("请输入第 d%节点",i+1);
scanf("d%",&val);

struct Node * pNew = (struct Node *)malloc(sizeof(struct Node));
if(pNew == NULL)
{ printf("分配失败,程序终止!");
exit(-1);
}

pNew->data = val;
pTail->data = pNew->data;
pTail->pNext =NULL;

}

traverse_list(pHead);
{
struct Node * p = pHead->pNext;
while (pNew == NULL)
{
printf("节点为 dd%",p->data);
p = p->pNext;
}

return;
}


}
1065 次点击
所在节点    问与答
1 条回复
comicfans44
2015-12-14 07:42:50 +08:00
struct Node * p = pHead->pNext;
while (pNew == NULL) -------------------------------> ???
{
printf("节点为 dd%",p->data);
p = p->pNext;
}

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/243275

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX