填空题

函数count(head)统计链表的结点个数,head为表头指针,阅读程序,要求将整个if语句改成while循环控制结构,其形式为 【9】
#include<stdio.h>
int count(NODE*head)
int n=0;
if(head!=NULL)
do
n++;
head=head->next;
while(head!=NULL);
return n;

【参考答案】

while(p!=NULL){n++;head=head→ next;}
热门 试题