libft
Loading...
Searching...
No Matches
Data Structures | Typedefs | Functions
ft_list.h File Reference

Linked list for libft. More...

+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  s_list
 

Typedefs

typedef struct s_list t_list
 Node structure for singly linked list.
 

Functions

void ft_del (void *content)
 Deletes content pointer in a list node (utility function).
 
void ft_lstadd_back (t_list **lst, t_list *new)
 Adds a node to the end of a list.
 
void ft_lstadd_front (t_list **lst, t_list *new)
 Adds a node to the front of a list.
 
void ft_lstclear (t_list **lst, void(*del)(void *))
 Clears an entire list, deleting all its nodes.
 
void ft_lstdelone (t_list *lst, void(*del)(void *))
 Deletes a single node using a deletion function.
 
void ft_lstiter (t_list *lst, void(*f)(void *))
 Applies a function to each element of the list.
 
t_listft_lstlast (t_list *lst)
 Returns the last node of the list.
 
t_listft_lstmap (t_list *lst, void *(*f)(void *), void(*del)(void *))
 Creates a new list by applying a function to each node.
 
t_listft_lstnew (void *content)
 Creates a new list node.
 
int ft_lstsize (t_list *lst)
 Counts the number of nodes in a list.
 

Detailed Description

Linked list for libft.

Author
Toonsa
Date
2025/04/05

This header defines the singly-linked list type t_list and the utility functions used to manipulate linked lists.

Features include:

Note
  • The list is singly linked, meaning each node points only to the next node.
  • The content pointer in each node can point to any type of data.
  • All functions are NULL-safe and follow defensive programming principles.