Code not taking all inputs


What’s the mistake in the code?

@J19APPPP0007
You missed the initial condition in your insert at tail function when head is NULL.
Use this piece of code
if(head == NULL) {
head = new Node(data) ;
return ;
}

This comes at the starting of the insertAtTail( ) .