Reverse a linked list from position m to n, in-place and in one pass /**
 * Definition for singly-linked list.
 * struct ListNode {
 *     int val;
 *     ListNode *next;
 *     ListNode(int x) : val(x), next(NULL) {}
 * };
 */

class Solution {
public:
    ListNode *reverseBetween(ListNode *head, int m, int n)
     {
        ListNode *pre=NULL, *cur=head, *front=NULL, *rear=NULL,*follow=head-&gt;next;
        int subLoop=n-m;
        if(m==1 &amp;&amp; subLoop==0)
        {
            return head;
        }

        if(m==1)
        {
            rear=head;
        }
        else
        {
            for(int i=0;i&lt;m-1;++i)
            {
                if(i==m-2)
                {
                    front=cur;
                }
                cur=cur-&gt;next;
            }
            rear=cur;
        }
        while(cur!=NULL&amp;&amp;subLoop--&gt;=0)
        {
            follow=cur-&gt;next;
            cur-&gt;next=pre;
            pre=cur;
            cur=follow;
        }
        if(m!=1)
        {
            front-&gt;next=pre;

        }
        else if(m==1&amp;&amp;pre!=NULL) 
        {
            head= pre;
        }
        rear-&gt;next=cur;
        return head;

    }
};
This is hard to read and follow:

    ListNode *pre=NULL, *cur=head, *front=NULL, *rear=NULL,*follow=head-&gt;next;


One variable per line:

This is really hard to read:

while(cur!=NULL&amp;&amp;subLoop--&gt;=0)


Not sure what the --&gt; operator does :-(

Your code could really do with a lot more white space between operators to make it readable.

To be honest I can not follow the logic of this function. Especially since I have not idea what the input parameters are supposed to represent:

ListNode *reverseBetween(ListNode *head, int m, int n)


What are m and n for?