己知带有头结点的单链表定义如下:
int f34(LinkList h,char string[]){ LinkList p,q;Char *pcint count=0;Pc=string;While(*pc!=’\0’){P=h;While(p->next!=null){if(p->next->ch!=*pc)P=p->next;Else break;}if(p->next==null){q=(LinkList)malloc(sizeof(ListNode));q->ch=*pc;q->next=p->next;p->next=q;count++;}Pc++;}Return count;}
正确答案int f34(LinkList h,char string[]){ LinkList p,q;Char *pcint count=0;Pc=string;While(*pc!=’\0’){P=h;While(p->next!=null){if(p->next->ch!=*pc)P=p->next;Else break;}if(p->next==null){q=(LinkList)malloc(sizeof(ListNode));q->ch=*pc;q->next=p->next;p->next=q;count++;}Pc++;}Return count;}