Problem in Linked list insertion code pls Help

can u tell me whats the problem in “insertAtMiddle” function
if I comment out insertAtMiddle(400,2,head) the code works fine so I think the problem is in else part of insertAtMiddle function . pls help me here is the code link
https://ide.codingblocks.com/s/407041