libft
Loading...
Searching...
No Matches
Functions
ft_list.c File Reference

Linked list operations for libft. More...

#include "libft.h"
+ Include dependency graph for ft_list.c:

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 operations for libft.

This file implements singly linked list operations for the custom libft library. It includes allocation, traversal, insertion, deletion, mapping, and utility functions. The functions operate on the t_list struct which stores a void* content pointer and a pointer to the next node.

These functions provide a flexible way to manipulate generic data structures, suitable for various use cases including stack, queue, and basic graph algorithms.

Author
Toonsa
Date
2025/04/05