我在C语言中使自己的某些代码段发疯,我希望进行干预。我有:指针混淆指针,以及列表之间的节点转移
typedef struct node{
int value;
node_t *next;
node_t *prev;
} node_t;
node_t current_node;
node_t other_list;
void transfer(node_t **ipp)
{
if (*ipp == NULL)
{
*ipp = current_node;
current_node->prev->next = current_node->next;
}
else
{
(*ipp)->next = current_node;
ipp = &(*ipp)->next;
current_node->prev->next = current_node->next;
}
}
int main(void)
{
int i;
for(i= 0; i< 10; i++)
{
transfer(&other_list);
current_node = current_node->next;
}
不应该我现在能够从第一个列表中删除项目,并将它们转移到第二个?还应该插入最后一个节点的other_list点?
你能更明确地表达你的问题吗?你期望发生什么?发生了什么呢? – cnicutar 2013-02-16 22:48:37