traverse pointer from last node to first
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: bn_ptr drive_temp(bn_ptr head,bn_ptr temp,bn_ptr current) { while(temp->next!=current) { temp=temp->next; current=temp; } temp=head; return current; } I have linked list and 'head' pointer hold first node , 'current' pointer hold last node,I want to bring 'current' to head one by one ,so I write this function but it gives segmentation fault when I debug the program 回答1: temp->next!=current will never be true unless temp==temp->next . Try this: bn_ptr drive_temp(bn_ptr head,bn_ptr temp,bn_ptr current) { while(temp->next!=current) { temp=temp-