Segmentation fault

hello @Prabhleen_sheenu
value of k can be greater than n as well so u need to handle this case.

to handle the case of k > n, you can simply do k = k % n to bring the value of k to be less than n.

Ohh okay sir.
This is my updated code.Sir,I request you to kindly look into the issue of segmentation fault too.

check ur updated code here

mistakes./updation
a) head should be passed as reference (u were passing by value)
b) u were not updating ur head after applying ur logic.
c) u were updating prev as prev=prev->next but actually it should be prev=current;
image

1 Like

Excellent Explanation.
Thank you sir :slight_smile: