O'Reilly logo

Sams Teach Yourself C++ in 24 Hours, Third Edition by Jesse Liberty

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Q&A

Q1:Why should I create a linked list if an array will work?
A1: An array must have a fixed size, whereas a linked list can be sized dynamically at runtime.
Q2:Why do you separate the data object from the node?
A2: Once you get your node objects working properly, you can reuse that code for any number of objects that might want to live in a list.
Q3:If I want to add other objects to the list, do I have to create a new list type and a new node type?
A3: For now, yes. We'll solve that when we get to templates.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required