1.

Which of the following will stop the loop at the last node of a linked list in the following C code snippet?

A. <pre class="prettyprint lang-c">while (p-&gt;next != NULL)<br> {<br> p = p-&gt;next;<br> }<br></pre>
B. <pre class="prettyprint lang-c">while (1)<br> {<br> p = p-&gt;next;<br> if (p == NULL)<br> break;<br> }<br></pre>
C. <pre class="prettyprint lang-c">while (p != NULL)<br> {<br> p = p-&gt;next;<br> }<br></pre>
D. All of above
E. None of these
Answer» B. <pre class="prettyprint lang-c">while (1)<br> {<br> p = p-&gt;next;<br> if (p == NULL)<br> break;<br> }<br></pre>


Discussion

No Comment Found

Related MCQs