Rotate a Linked List about certain node

for k=3;
inputLL=1->2->3->4->5
output should be=4->5->1->2->3
i am getting error only because of one line.
please help…

https://ide.codingblocks.com/s/47245

Hey Ankur, in line:90 change your while loop’s condition from while(temp2!=NULL) to while(temp2->next!=NULL) . In your current code temp2 becomes NULL and when you try to point temp2->next = head it gives run error as you can’t access NULL->next.

thank you. its working now

No problem :slight_smile:
Keep Coding and raising doubts :slight_smile: