temp2 = temp->next;Quote:
Originally Posted by quzah
done.
temp = temp2;Quote:
Originally Posted by quzah
using the node created in step 1.
Code:
custNode *reverse(custNode *current)
{
custNode *temp2;
for( custNode *temp = current; temp; temp = temp2 )
{
temp2 = temp->next;
temp->next = temp2;
temp = temp2; // updated line
}
return temp2;
}
done, temp2 the new reordered list is returned.Quote:
So you need a seperate pointer to store that.
The for loop is not running endlessly this time, but the list is still ordered..pfft. :(