Libft is the first project at 1337 School that consists of re-coding a set of standard C library functions, along with additional utility functions that will be reused throughout future projects.
- Built with: C
- Focus: Rebuilding core C standard library functions and utility functions from scratch.
- What I learned: Pointers, strings, memory manipulation, linked lists, clean function design, and low-level debugging.
A foundation library built from scratch to understand memory, pointers, and data structures in C.
The goal of Libft is to understand, implement, and master the core mechanisms of C programming:
- Memory management (
malloc,free, pointer arithmetic) - String manipulation
- Linked lists
- Static functions and modular organization
- Compilation via
Makefile
You end up with your own library, libft.a, that can be linked to any future C project.
Clone the repository and run:
make # builds mandatory part
make bonus # builds with bonus (linked list functions)
make clean # removes object files
make fclean # removes objects and libft.a
make re # rebuild everything`libft/
├── Makefile
├── libft.h
├── ft_*.c
└── (bonus) ft_lst*.c
| Category | Functions |
|---|---|
| Character checks | ft_isalpha ft_isdigit ft_isalnum ft_isascii ft_isprint |
| String length / memory | ft_strlen ft_memset ft_bzero ft_memcpy ft_memmove |
| String search / compare | ft_strlcpy ft_strlcat ft_strchr ft_strrchr ft_strncmp ft_memchr ft_memcmp ft_strnstr |
| Conversion | ft_atoi |
| Memory allocation | ft_calloc ft_strdup |
| Character case | ft_toupper ft_tolower |
| Category | Functions |
|---|---|
| String manipulation | ft_substr ft_strjoin ft_strtrim ft_split |
| Conversion | ft_itoa |
| Function pointers | ft_strmapi ft_striteri |
| File descriptors (output) | ft_putchar_fd ft_putstr_fd ft_putendl_fd ft_putnbr_fd |
| Function | Description |
|---|---|
ft_lstnew |
Create a new node |
ft_lstadd_front |
Add a node at the beginning of the list |
ft_lstsize |
Count the number of nodes |
ft_lstlast |
Return the last node of the list |
ft_lstadd_back |
Add a node at the end of the list |
ft_lstdelone |
Delete one node using a function del |
ft_lstclear |
Delete and free all nodes |
ft_lstiter |
Apply a function to each node’s content |
ft_lstmap |
Create a new list resulting from the successive applications of a function |
After building the library, you can use it in any C project:
make
cc main.c libft.a -o my_program
./my_program| Check | Result |
|---|---|
| Norminette | ✅ Passed |
| Memory leaks | ✅ None (checked with Valgrind) |
| Mandatory part | ✅ Completed |
| Bonus part | ✅ Completed |
| Segfaults | 🚫 None |
| Compilation flags | -Wall -Wextra -Werror |
Walid Krati [wkrati]
AKA: Kratos
🎓 1337 / 42 Network