Libft is a project from the 42 São Paulo Common Core curriculum. It consists of a static C library (libft.a) containing general-purpose functions designed to serve as foundational tools for subsequent C programming assignments.
42 São Paulo is a tuition-free, global coding school focused on peer-to-peer learning and project-based education. This project introduces core C programming concepts by reimplementing standard library functions and creating custom utilities.
Libft provides a collection of functions split into two sections:
- Mandatory Part: Reimplementations of libc functions (e.g.,
ft_strlen,ft_memcpy) and additional tools (e.g.,ft_substr,ft_split). - Bonus Part: Linked list manipulation functions (e.g.,
ft_lstnew,ft_lstadd_front).
- Rebuilt standard C functions with the
ft_prefix. - Custom string and memory manipulation utilities.
- Bonus linked list management using a
t_liststructure. - Strict memory management with no leaks.
- Written in C, compliant with the 42 Norm.
- No global variables or unexpected crashes.
- Compiled with
-Wall -Wextra -Werror. - Limited external functions (e.g.,
malloc,free,write).
- C compiler (e.g.,
clang). makeutility.
-
Clone the repository:
git clone https://github.com/LuizGandra/libft-42.git cd libft-42 -
Build the mandatory part:
make
-
Build the bonus part (optional):
make
This includes linked list functions in libft.a.
-
Link the library to your C project:
clang -o <program> <file>.c -L<libft.a directory> -lft
make clean: remove object files.make fclean: remove the program and object files.make re: rebuild everything.
libft.h: function prototypes.ft_*.c: mandatory function sources.ft_*_bonus.c: bonus function sources.Makefile: compilation automation.
This project is part of the 42 curriculum and intended for educational use.