/ Published in: C++
this pointers are making me dizzy, so just for a reference i'll keep them here.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
NodePtr reversed=NULL, cur=head; while(cur!=NULL) { //detach cur head=head->next; //link cur to reversed list cur->next=reversed; reversed=cur; //move cur to next node cur=head; head=reversed; }