Consider the following linked list :
Which of the following piece of code will insert the node pointed to by $q$ at the end of the list ?
$\text{for (p=list; p !=NULL; p=p → next);}\\ p=q;$
$\text{for (p=list; p !=NULL; p=p → next);}\\ \text{p→next=q;}$
$\text{for (p=list; p→next !=NULL; p=p → next);}\\ p=q;$
$\text{for (p=list; p→next !=NULL; p=p → next);}\\ p→next=q;$
64.3k questions
77.9k answers
244k comments
80.0k users