![]() Usually a block in a linked list is represented through a structure like this : struct test_struct Now, one would ask how are they connected or how they can be traversed? Well, they are connected through pointers. Linked list basically consists of memory blocks that are located at random memory locations. In scenarios like these, linked lists (or other dynamic data structures) are used as their capacity can be increased (or decreased) at run time (as an when required). For example, In an employee management system, one cannot use arrays as they are of fixed length while any number of new employees can join. When to prefer linked lists over arrays? Linked lists are preferred mostly when you don’t know the volume of data to be stored. In an array, all the elements are kept at consecutive memory locations while in a linked list the elements (or nodes) may be kept at any location but still connected to each other.While, a linked list is a dynamic data structure. This means the length of array cannot be altered at run time. How Linked lists are different from arrays? Consider the following points : Linked list is a dynamic data structure whose length can be increased or decreased at run time. This article explains the fundamentals of C linked list with an example C program. Knowledge of linked lists is must for C programmers. Linked list is one of the fundamental data structures in C. ![]()
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |