实验11-2-7 统计专业人数 思路:链表的遍历 错误:明明看到char了,仍然在判断中写int。 int countcs( struct ListNode *head) { int i=0,cnt=0; struct ListNode *ptr; for(ptr=head;ptr!=NULL;ptr=ptr->next) { if(ptr->code[1]=='0'&&ptr->code[2]=='2') { cnt++; } } return cnt; }