数据结构关于链表求解答

有一个单链表,其头指针为head,编写一个函数计算域为x的结点个数(不同结点元素值可能相同)。

int getCount(LinkList head,int x)
{
      LinkList p = head;
      int count = 0;
      while(p != NULL)
      {
            if(p->data == x)
                count++;
            p = p->next;
      }
      return count;
}


int findCount(LinkList *head, int x)
{
    int count = 0;
    while (head->next != NULL)
    {
        head = head->next;
        if (head->score == x)
        {
            count++;
        }
    }
    return count;
}