Insert a Node at the Tail of a Linked List

  • + 0 comments

    `cpp Node* Insert(Node *head,int data) { Node *temp,*prev; temp->data=data; temp->next=NULL; prev=head; if(prev==NULL) head=temp; while((prev->next)!=NULL) prev=prev->next;

    prev->next=temp;
    

    return head;

    } could you tell me the error