K Append run error

https://ide.codingblocks.com/s/178204 One test case is showing run error. What to change?

before passing k to the function take k%= len
the code then passes the test case

I’m doing that in line 49 within the function though

yes i saw that.
but then you`ll have to insert the condition
of temp != NULL

when k == n
then this would give overflow
what i am doing is when k == n then then k%n == 0 so it does not get inside the function

while(jump<n-k){
temp=temp->next;
jump++;
}
Either u put a condition of temp != NULL and jump < n-k inside while loop

1 Like

Ok I understood now, thank you! :slight_smile:

1 Like