while(head->next) { temp=head; while(tempp->next->next) { temp=temp->next; } pop=temp->next; pop->next=head; temp->next=0; }