给定下列C函数: 整数单链表作为参数,函数重新排列列表的元素 ...
发布于 2022-03-03 17:32:10
给定下面函数:整数单链表作为参数,函数重新排列列表的元素。
现以顺序为 1, 2, 3, 4, 5, 6, 7 的整数列表调用该函数
struct node { int value struct node *next } void rearrange(struct node *list) { struct node *p, * q int temp if ((!list) || !list -> next) return p = list q = list -> next while(q) { temp = p -> value p -> value = q -> value q -> value = temp p = q -> next q = p ? p -> next:0 } }
函数执行后列表的内容是()
登录后免费查看答案
关注者
0
被浏览
18