これは、リンクされたリストの n 番目のノードを返す関数ですが、戻り値の型は int でなければならないというコンパイラ エラーが常に発生します。何故ですか?
struct Node *getNthNode(struct Node* head, int index)
{
if (head==NULL)
return NULL;
struct Node *current = head;
int count = 0;
while (current)
{
if (count == index)
return(current);
count++;
current = current->next;
}