【发布时间】:2015-09-29 13:48:09
【问题描述】:
我是 C++ 新手,很难理解链表中的插入。这是我迄今为止一直在处理的插入,我只是在添加多个节点时遇到了麻烦。
struct node *temp, *x, *y;
temp = create_node(a, b, c);
x = begin;
if (begin == NULL)
{
begin = temp;
temp->next = NULL;
}
else
{
y = temp;
temp->next = NULL;
}
【问题讨论】:
-
欢迎来到 Stack Overflow!请将您的问题editminimal reproducible example 或SSCCE (Short, Self Contained, Correct Example)
-
在C++中你可以使用std::list
-
我用的是我自己的。我只是想弄清楚如何正确插入
标签: c++ insert linked-list nodes