void reverse(struct student *ls)
{
struct student *last = ls->next;
struct student *pre = ls;
struct student *cur = ls->next;
struct student *next = NULL;
while(cur)
{
next = cur->next;
cur->next = pre;
pre = cur;
cur = next;
}
ls->next = pre;
last->next = NULL;
}
这是将链表逆置的函数,头节点不变,
while里面的循环本人实在是看不懂。
哪位高手能通俗点讲一下么?谢谢!
解决方案:20分
参看:http://blog.csdn.net/zhangxiangdavaid/article/details/26291113
假如,看不懂,可以边看边画图~
假如,看不懂,可以边看边画图~
解决方案:20分