What is error in this code


#1

/
ListNode
Solution::swapPairs(ListNode* A) {
ListNodehead=A;
ListNode
prev,*curr;
prev=NULL;
int count=2;

while(count)
{ curr=head->next;
    head->next=prev;
    prev=head;
    head=curr;
    count--;
}

// if(curr!=NULL && curr->next==NULL)
//return curr;
if(curr!=NULL)
{ if(curr->next!=NULL)
{ A->next=swapPairs(curr);
return prev;}
else if(curr->next==NULL)
{return curr;}

    }

}