This project has been created as part of the 42 curriculum by ibcolak.
libft is a static C library (libft.a) that reimplements commonly used functions
from the C standard library (libc) — prefixed with ft_ — and adds extra functions
for string/memory manipulation, writing to file descriptors, and singly linked list
(t_list) operations. It serves as a foundational building block used across almost
every subsequent project in the 42 curriculum.
The library provides a wide array of functions, all defined within the libft.h
header file. The implementations are categorized as follows:
- Character Classification:
ft_isalnum.c,ft_isalpha.c,ft_isascii.c,ft_isdigit.c,ft_isprint.c - Memory Management:
ft_bzero.c,ft_calloc.c,ft_memchr.c,ft_memcmp.c,ft_memcpy.c,ft_memmove.c,ft_memset.c - String Manipulation:
ft_split.c,ft_strchr.c,ft_strdup.c,ft_striteri.c,ft_strjoin.c,ft_strlcat.c,ft_strlcpy.c,ft_strlen.c,ft_strmapi.c,ft_strncmp.c,ft_strnstr.c,ft_strrchr.c,ft_strtrim.c,ft_substr.c - Linked List Operations:
ft_lstadd_back.c,ft_lstadd_front.c,ft_lstclear.c,ft_lstdelone.c,ft_lstiter.c,ft_lstlast.c,ft_lstmap.c,ft_lstnew.c,ft_lstsize.c - Conversions & File Descriptor I/O:
ft_atoi.c,ft_itoa.c,ft_tolower.c,ft_toupper.c,ft_putchar_fd.c,ft_putendl_fd.c,ft_putnbr_fd.c,ft_putstr_fd.c
To compile and use the library, you will use the provided Makefile.
- Compilation: Run
makein the root directory. This will compile all the.cfiles into a static library namedlibft.a. - Clean: Run
make cleanto remove object files generated during compilation. - Full Clean: Run
make fcleanto remove both the object files and the compiledlibft.alibrary. - Recompile: Run
make reto completely clean and recompile the library from scratch. - Integration: To use this library in your own projects,
#include "libft.h"in your C files and compile your project with the generatedlibft.astatic library.
- Documentation: Standard man pages (
man 3 strlen,man 3 memcpy,man 3 calloc, etc.), cppreference - C, and w3schools - C. - Linked Lists: Singly Linked List Tutorial - GeeksforGeeks and Linked List - Medium.
- Memory Functions: Difference between malloc and calloc - GeeksforGeeks.
- Makefile: What is a Makefile and how to use it and Opensource.com.
- 42 Norm: norminette documentation.
AI usage: Used to find bugs I couldn't spot on my own, format the code to follow 42 Norm rules, review the code, and clarify questions about the project.
Passed with a perfect 100/100 on the first attempt — zero initial errors across all 43 mandatory and bonus tests, evaluated solo by the official 42 moulinette.
Character Classification — 5/5 ✅
| Function | Result |
|---|---|
ft_isalpha |
✅ |
ft_isdigit |
✅ |
ft_isalnum |
✅ |
ft_isascii |
✅ |
ft_isprint |
✅ |
Memory Management — 7/7 ✅
| Function | Result |
|---|---|
ft_memset |
✅ |
ft_bzero |
✅ |
ft_memcpy |
✅ |
ft_memmove |
✅ |
ft_memchr |
✅ |
ft_memcmp |
✅ |
ft_calloc |
✅ |
String Manipulation — 14/14 ✅
| Function | Result |
|---|---|
ft_strlen |
✅ |
ft_strlcpy |
✅ |
ft_strlcat |
✅ |
ft_strchr |
✅ |
ft_strrchr |
✅ |
ft_strncmp |
✅ |
ft_strnstr |
✅ |
ft_strdup |
✅ |
ft_substr |
✅ |
ft_strjoin |
✅ |
ft_strtrim |
✅ |
ft_split |
✅ |
ft_strmapi |
✅ |
ft_striteri |
✅ |
Conversions & File Descriptor I/O — 8/8 ✅
| Function | Result |
|---|---|
ft_atoi |
✅ |
ft_itoa |
✅ |
ft_toupper |
✅ |
ft_tolower |
✅ |
ft_putchar_fd |
✅ |
ft_putstr_fd |
✅ |
ft_putendl_fd |
✅ |
ft_putnbr_fd |
✅ |
Linked List Operations (Bonus) — 9/9 ✅
| Function | Result |
|---|---|
ft_lstnew |
✅ |
ft_lstadd_front |
✅ |
ft_lstadd_back |
✅ |
ft_lstsize |
✅ |
ft_lstlast |
✅ |
ft_lstdelone |
✅ |
ft_lstclear |
✅ |
ft_lstiter |
✅ |
ft_lstmap |
✅ |
Verified with the official 42 Libft moulinette.
