【发布时间】:2013-12-22 14:41:42
【问题描述】:
我的代码是将节点添加到头部,但我希望将它们添加到尾部。我尝试将头指向下一个节点为空,但由于下一个节点为空而停止
if(head==NULL)
{
head=node;
}
else
{
node->next=head;
node->prev=NULL;
head->prev=node;
head=node;
}
printf("The node is inserted to linked list succesfully. \n\n");
printMenu();
【问题讨论】:
-
记得选择您认为最有帮助的答案并接受。整个堆栈的想法发挥作用非常重要。
标签: c linked-list