Gives segmentation fault!

while doing deletion in a circular list, my code gives segmentation fault, although it works well, when doing insertion a node.
my code is :-https://ide.codingblocks.com/s/353894

Hey @Nikhil-Jettley-2567269533523013
Here updated ur code and mentioned the changes in comments : https://ide.codingblocks.com/s/353914
If this resolves ur issue then please mark it as resolved :slight_smile:

sir, i canot able to understand the 2nd if condition ,in which when deleted node is present at head ,please explain your logic.

Assume we have only one node in LL
i.e 5->pointing to itself
and u try to delete it then it will give u segmentation
So I checked if head=head->next && head=del (In else part) then simply delete del ,make head =NULL and return

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.