Linked list problem

I want to reverse every three values of my linked list but it it gives me a SIGSEGV error.Can someone tell me what is wrong with the code? Thanks in advance.
(eg. for input : 1->2->3->4->5->6->7->8 , output should be 3->2->1->6->5->4->7>8 )
Here is the link to my code:

What’s with this
head->i=10 ???

@dush22 i just initialized the head.


There seems to be a flaw in your swapping logic.This works.

Link to rectified code-

Plus next time try to find the bug on ur own.Dry running the logic in ur head will help u find bugs and lead to a better understanding of linked list.If the Seg error appears in an exam there will be no forum to help u.