Click to expand
libft is a custom C library project, part of the 42 School curriculum. This project aims to:
- Recreate various standard C library functions
- Develop additional utility functions
- Enhance understanding of basic algorithms and data structures
- Improve C programming skills
The library serves as a foundation for future projects in the 42 curriculum.
Key Features
- 🔄 Reimplementation of standard C library functions
- 🧰 Additional utility functions for string and memory operations
- 🔗 Bonus functions for linked list manipulations
- 🧪 Thoroughly tested for reliability
- 📚 Comprehensive documentation
Step-by-step guide
- Clone the repository:
git clone [email protected]:melaniereis/42_libft.git cd 42_libft
- Compile the library:
bash make
- To include bonus functions:
bash make bonus
How to use libft in your projects
-
Include the header in your C file:
#include "libft.h"
-
Compile your program with the library:
bash cc your_program.c -L. -lft -o your_program
- Example usage:
#include "libft.h" #include <stdio.h>
int main() { char *str = ft_strdup("Hello, libft!"); printf("%s\n", str); free(str); return 0; }
Libc Functions
Character checks: ft_isalpha, ft_isdigit, ft_isalnum, ft_isascii, ft_isprint
String operations: ft_strlen, ft_strlcpy, ft_strlcat, ft_strchr, ft_strrchr, ft_strncmp, ft_strnstr
Memory operations: ft_memset, ft_bzero, ft_memcpy, ft_memmove, ft_memchr, ft_memcmp
Character conversions: ft_toupper, ft_tolower
String to integer: ft_atoi
Memory allocation: ft_calloc, ft_strdup
Additional Functions
String manipulations: ft_substr, ft_strjoin, ft_strtrim, ft_split, ft_itoa, ft_strmapi, ft_striteri
File descriptor operations: ft_putchar_fd, ft_putstr_fd, ft_putendl_fd, ft_putnbr_fd
Bonus Functions
Linked list operations: ft_lstnew, ft_lstadd_front, ft_lstsize, ft_lstlast, ft_lstadd_back, ft_lstdelone, ft_lstclear, ft_lstiter, ft_lstmap
File organization
text . ├── libft.h # Header file ├── ft_*.c # Source files for each function ├── Makefile # Compilation rules └── README.md # Project documentation
Maintenance commands
-
Remove object files:
bash make clean
-
Remove object files and the library:
bash make fclean
- Recompile everything:
bash make re
Melanie Reis
🏫 42 School Student
💼 LinkedIn
🐙 GitHub
Special thanks
42 School for the comprehensive curriculum
The C Programming Language by Brian Kernighan and Dennis Ritchie
Fellow 42 students for their support and collaboration