You are viewing a single comment's thread. Return to all comments →
According to the problem statement...
1.)You need to figure out a way if head=NULL i.e if the list is empty but when you declare "if(head->next==NULL)" it means that you are consider only the non empty case.
2.)Even in this above case you are just returning "newn" nut you need to return thr address of first node which is "head"!
if(head==NULL) block of statements also