问答题

如下程序的功能为对链表中所有结点数据域内容求和,其中head指向一个带头结点的单链表,在下划线处需要分别填入的正确内容为______。 struct link{ int data; struct link * next; } int main(void){ struct link * head; sum(head); } int sum(_______){ struct link * p; int s=0; p=head->next; while(p){ s+=_______; p=_______; } }
A、struct link *head p->data p->next
B、struct link head p->data p->next
C、struct link *head p->next->data p->next
D、struct link *head p->data p

答案: A
微信扫码免费搜题