C语言链表合并 的问题,各位大虾来帮下忙哈
struct Node * inter_link(struct Node * chain1, int a, struct Node * chain2, int b) {int temp;
struct Node *head, *p1, *p2, *pos;
if (a >= b) {
head = p1 = chain1;
p2 = chain2;
} else {
head = p1 = chain2;
p2 = chain1;
temp = a, a = b, b = temp;
}
pos = head;
while (p2 != NULL) {
p1 = p1->next;
pos->next = p2;
pos = p2;
p2 = p2->next;
pos->next = p1;
pos = p1;
}
return head;
}
我就是想不明白这函数是怎么个运行过程,求解释,能附图最好了