O'Reilly logo

C Programming: Visual Quickstart Guide by Marc Liyanage, Larry Ullman

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

Introduction to Linked Lists

The problem with static arrays (like the array of structures in our previous example) is that they can have only a finite number of elements. This value is set during compilation, meaning that when you write the program, you must know and set the maximum number of elements to ever be stored. In Chapter 10, “Managing Memory,” you learned how to make a dynamically sized array using realloc(), which increased the amount of available memory as needed. Linked lists allow you to combine these two concepts, creating a growing list of structures.

A linked list takes structures one step further by making them self-referential. This is accomplished by defining a structure as containing both data (the actual information being ...

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