Chapter 18: Problem 14
Show what is produced by the following \(\mathrm{C}++\) code. Assume the node is in the usual info-link form with the info of type int. (list and ptr are pointers of type nodeType.) 1ist \(=\) new nodeType; \(1 \mathrm{ist} \rightarrow \mathrm{info}=20\) ptr \(=\) new nodeType; \(p t r->i n f 0=28\) \(p t r->1\) ink \(=N U L L\) 1 ist \(->\operatorname{link}=\) ptr ptr \(=\) new nodeType; \(p t r->i n f 0=30\) \(p t r->1\) ink \(=1\) ist list \(=\operatorname{ptr}\) ptr \(=\) new nodeType; \(p t r->i n f 0=42\) \(p t r->1 i n k=1 i s t->1 i n k\) \(1 i s t->1 i n k=p t r\) \(p t r=1\) ist while (ptr != NULL) $$\\{$$ $$\begin{array}{l} \text { cout }<<\operatorname{ptr} \rightarrow \inf _{0}<<\text { end } 1 ; \\\ \operatorname{ptr}=\operatorname{ptr} \rightarrow \operatorname{lin} \mathrm{k} ; \end{array}$$ $$\\}$$
Short Answer
Step by step solution
Key Concepts
These are the key concepts you need to understand to accurately answer the question.