Linked Lists
- /
- The Blog — Skills & Methods /
- Linked Lists
- Michael
- C , Programmation
- October 11, 2025
Table of Contents
Lists do not natively exist in C; they are the result of manipulating pointers and structures.
Unlike arrays, lists make it easier and more flexible to manage data structures.
You can insert, delete, modify, move elements more easily.
The elements of a linked list are stored in a structure.
struct digits {
int number;
char *name;
struct digits *next;
};
Malloc must be used for the pointer that will point to the structure. The main below assigns basic values to the elements of our list.
#include <stdlib.h>
int main(void)
{
struct digits *myList;
myList = malloc(sizeof (struct digits));
if (!myList)
return (0);
myList->number = 0;
myList->ft_strdup("zero");
myList->next = NULL;
return (0);
}
Sources :