“Build your own standard library – and truly understand the language.”
LIBFT is a personal C library crafted from scratch as part of the 42 Abu Dhabi School curriculum. Completed on 23 November 2023, the project’s objective was to deepen understanding of core C functionalities by re-implementing standard library functions and building custom ones. The result is a flexible, portable static library ready to be reused in future C projects.
📦 Static Library
⚙️ Pure C
🏗️ Built for Reusability
Run the command make to create the libft.a library file.
In future projects, the libft will be used by placing this libft folder in the projects folder. The libft.a library will be compiled at the same time as the project by adding the following rule to the Makefile :
libft:
make -C libft/
As well as the following flags to the compilation of the sources of the project :
-I./libft/includes/ -L./libft -lft
ft_isalphaft_isdigitft_isalnumft_isasciift_isprintft_iswhitespace(BONUS)ft_toupperft_tolower
ft_strlenft_strnewft_strdelft_strclrft_striterft_striterift_strcmpft_strncmpft_strequft_strnequft_strdupft_strcpyft_strncpyft_strcatft_strncatft_strlcatft_strchrft_strstrft_strnstrft_strsubft_strjoinft_strtrimft_strsplit
ft_memsetft_bzeroft_memcpyft_memccpyft_memmoveft_memchrft_memcmpft_memallocft_memdel
ft_lstnewft_lstdeloneft_lstdelft_lstaddft_lstiterft_lstmapft_strsplitlstft_lstcpyft_lstappend
ft_atoift_itoaft_itoa_base(BONUS)
ft_putcharft_putchar_fdft_putstrft_putstr_fdft_putendlft_putendl_fdft_putnbrft_putnbr_fdft_putstrarray(BONUS)ft_putfile(BONUS)ft_printbits(BONUS)ft_putwchar(BONUS)
ft_fopenft_fcloseft_fgetc
-
ft_filelinecount -
ft_double_power -
ft_ldouble_power -
ft_wchar_to_bytes -
ft_array_swap -
ft_tabdel -
ft_nbdigits -
ft_nbdigits_base
Completing the LIBFT project was a deep dive into the fundamentals of C programming and software craftsmanship. Here are the key concepts and skills I developed:
-
🔹 Memory Management
- Manual memory allocation and deallocation using
malloc,free, and related functions - Understanding buffer overflows, memory leaks, and alignment issues
- Manual memory allocation and deallocation using
-
🔹 Pointers and Addresses
- Mastering pointer arithmetic and dereferencing
- Building and navigating linked data structures
-
🔹 String Handling
- Re-implementing core string functions and managing null-terminated arrays
-
🔹 Modular Code Design
- Writing reusable, clean, and readable functions
- Organizing code into logical modules
-
🔹 Static Libraries
- Creating and using a
.aarchive for modular compilation - Integrating custom libraries into other C projects
- Creating and using a
-
🔹 Makefiles
- Automating builds with custom rules and dependency management
-
🔹 Data Structures
- Building and manipulating linked lists and string arrays
-
🔹 Low-level Debugging
- Using tools like
gdbandvalgrindto debug and profile code
- Using tools like
-
🔹 Terminal Output
- Managing character and string output using file descriptors
-
🔹 File Handling (Bonus)
- Reading from and writing to files using basic stream-like functions
-
🔹 Clean Coding Practices
- Applying naming conventions, file organization, and documentation
Here’s a screenshot of the successful (score: 125%):
