Can anyone help me out? i can't figure out whats wrong!


#1

ListNode* Solution::reverseBetween(ListNode* A, int B, int C) {
if(A->next==NULL)
return A;
ListNode *m=A,*n=A,*prev,*fut;
ListNode *cur,*p,*q,*f;
for(int i=1;i<B;i++)
{
prev=m;
m=m->next;
}
for(int j=1;j<C;j++)
{
n=n->next;
}
fut=n->next;
p=m;
cur=p->next;
f=cur->next;
while(cur!=fut)
{
cur->next=p;
p=cur;
cur=f;
if(f!=NULL)
f=f->next;
}
prev->next=p;
m->next=fut;
return A;

}