See this code i am not able to insert the node at the last position
Hello @anshulgurawalia which node you want to insert at tail.
you are trying to insert the nodes only at head and in between.
@anshulgurawalia it is being inserted at 4th position only.
tell me after which node you want to insert?
i am trying to insert the node after the node having value ==3 ( i.e. 4 position)
i am slightly confuse about the both statement
node !=null;
and node->next!=null ;
@anshulgurawalia see if you are doing for doing this:
node !=null;
then this means that your while loop will end after the whole list is traversed.
but in this the while loop will stop before the last node because at last node the while condition becomes true as to the next of the last null is connnected.
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.