- When and why using linked lists vs arrays
- How to build and use linked lists
-
0. Print list
- 0-print_list.c: C function that prints all the elements of a
list_t
list- Prototype:
size_t print_list(const list_t *h);
- Return: the number of nodes
- If
str
isNULL
, print[0] (nil)
printf
is allowed
- Prototype:
- 0-print_list.c: C function that prints all the elements of a
-
1. List length
- 1-list_len.c: C function that returns the number of elements in a linked
list_t
list.- Prototype:
size_t list_len(const list_t *h);
- Prototype:
- 1-list_len.c: C function that returns the number of elements in a linked
-
2. Add node
- 2-add_node.c: C function that adds a new node at the beginning of a
list_t
list.- Prototype:
list_t *add_node(list_t **head, const char *str);
- Return: the address of the new element, or
NULL
if it failed str
needs to be duplicatedstrdup
is allowed
- Prototype:
- 2-add_node.c: C function that adds a new node at the beginning of a
-
3. Add node at the end
- 3-add_node_end.c: C function that adds a new node at the end of a
list_t
list.- Prototype:
list_t *add_node_end(list_t **head, const char *str);
- Return: the address of the new element, or
NULL
if it failed str
needs to be duplicatedstrdup
is allowed
- Prototype:
- 3-add_node_end.c: C function that adds a new node at the end of a
-
4. Free list
- 4-free_list.c: C function that frees a
list_t
list.- Prototype:
void free_list(list_t *head);
- Prototype:
- 4-free_list.c: C function that frees a
-
5. The Hare and the Tortoise
- 100-first.c: C function that prints
You're beat! and yet, you must allow,\nI bore my house upon my back!\n
before themain
function is executedprintf
is allowed
- 100-first.c: C function that prints
-
6. Real programmers can write assembly code in any language
- 101-hello_holberton.asm: 64-bit assembly program that prints
Hello, Holberton
, followed by a new line.printf
is allowed- Interrupts are not allowed
- 101-hello_holberton.asm: 64-bit assembly program that prints