temp2 = temp->next;Originally Posted by quzah
done.
temp = temp2;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.
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.![]()



LinkBack URL
About LinkBacks



