删除列表中的节点
*x = L->list[i]; /* Save the deleted element to parameter x */
for(j = i+1; j <= L->size-1; j++)
L->list[i] = L->list[i+1];
L->size--; /* The number of data elements is reduced by 1*/
return 1;
我无法完全删除节点,而不是它只是替换值,但没有删除节点本身
*x = L->list[i]; /* Save the deleted element to parameter x */
for(j = i+1; j <= L->size-1; j++)
L->list[i] = L->list[i+1];
L->size--; /* The number of data elements is reduced by 1*/
return 1;
I can't delete the node fully, instead of this, its just replacing the value, but the node itself is not deleted
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在此内,
此语句中使用的变量
i
没有更改。
看来您的意思是,
如果数组
list
动态分配,则应该重新分配它,因为例如,您需要将
t
用数组的实际类型替换。我正在使用t
,因为从您的问题中不知道该数组的元素类型是什么。Within this for loop
the variable
i
used in this statementis not being changed.
It seems you mean
If the array
list
is allocated dynamically then you should reallocate it as for exampleYou will need to substitute
T
with the actual type of elements of the array. I am usingT
because it is unknown from your question what is the type of elements of the array.