Insertion at end

pl. provide me code for insertion at tail function…i am facing some problem that is when i insert a node it is not updates in head pointer…pl. provide me the code

https://ide.codingblocks.com/s/230552 pl… check my code also and point my mistake

@lakshaygarg128 condition for the "temp"variable in the while loop should be temp->next != NULL

i have done that change but still same problem

@lakshaygarg128 sorry my bad, I forgot to point out the other mistake. After the while loop ends, temp is pointing to the last node of the list, so you have to do temp->next = new node(data)

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.