A personal C standard library, reimplementing common functions from scratch, built as part of 42's common core curriculum.
Libft is the very first project of 42's common core: a custom C library recreating a set of standard library functions (string manipulation, memory handling, character checks) along with additional utility functions not found in the standard library. It's built early in the curriculum and then reused as a foundation across virtually every subsequent C project — a way to have a trusted, well-tested personal toolbox available at all times.
- Character checks:
ft_isalpha,ft_isdigit,ft_isalnum,ft_isascii,ft_isprint,ft_toupper,ft_tolower - String functions:
ft_strlen,ft_strlcpy,ft_strlcat,ft_strchr,ft_strrchr,ft_strncmp,ft_strnstr,ft_atoi - Memory functions:
ft_memset,ft_bzero,ft_memcpy,ft_memmove,ft_memchr,ft_memcmp - Allocation-based functions:
ft_strdup,ft_substr,ft_strjoin,ft_strtrim,ft_split,ft_itoa,ft_strmapi,ft_striteri - Output functions:
ft_putchar_fd,ft_putstr_fd,ft_putendl_fd,ft_putnbr_fd
- Linked list utilities:
ft_lstnew,ft_lstadd_front,ft_lstadd_back,ft_lstsize,ft_lstlast,ft_lstdelone,ft_lstclear,ft_lstiter,ft_lstmap
(Check/remove sections depending on what you actually implemented.)
makeThis generates libft.a at the root of the project.
Other available targets:
make clean # removes object files
make fclean # removes object files and the library
make re # rebuilds the library from scratch
make bonus # also compiles the linked list functionsInclude the header and link the library when compiling a project that uses it:
#include "libft.h"
int main(void)
{
char *joined;
joined = ft_strjoin("Hello, ", "world!");
ft_putendl_fd(joined, 1);
free(joined);
return (0);
}cc -Wall -Wextra -Werror main.c -L. -lft -o test
./testlibft/
├── ft_*.c # individual function files
├── libft.h
├── Makefile
└── README.md
(Adjust this tree to match your actual project structure — some implementations split files into subfolders like str/, mem/, list/.)
- Reimplementing the fundamentals of a C standard library, function by function
- Writing safe, defensive C: correct handling of
NULLpointers, edge cases, and buffer boundaries - Careful memory management, including proper cleanup on partial allocation failures
- Building and maintaining a static library (
.a) meant to be reused across many future projects - The value of writing well-tested, reliable low-level utilities before building more complex programs on top of them
- Nathan Jeanbourquin — 42
Project built as part of the 42 curriculum. Educational use.