Consider the case when you insert at the end of the list. Then you get
// current = NULL
current->next = nextnode;
// is ((struct node*)NULL)->next = nextnode;
solved I am getting Segmentation fault (core dumped) for below code.Please help me out [closed]