This project is a custom implementation of various standard C library functions, created as part of the 42 school curriculum. The library serves as a foundation for future C programming projects at 42.
The library includes:
- Reimplementations of standard libc functions
- Additional utility functions
- Linked list manipulation functions (Bonus part)
| Function | Description |
|---|---|
| ft_isalpha | Check if character is alphabetic |
| ft_isdigit | Check if character is a digit |
| ft_isalnum | Check if character is alphanumeric |
| ft_isascii | Check if character is in ASCII table |
| ft_isprint | Check if character is printable |
| ft_strlen | Calculate string length |
| ft_memset | Fill memory with a constant byte |
| ft_bzero | Zero a byte string |
| ft_memcpy | Copy memory area |
| ft_memmove | Copy memory area with overlap handling |
| ft_strlcpy | Copy string to a specific size |
| ft_strlcat | Concatenate string to a specific size |
| ft_toupper | Convert char to uppercase |
| ft_tolower | Convert char to lowercase |
| ft_strchr | Locate character in string |
| ft_strrchr | Locate character in string from the end |
| ft_strncmp | Compare two strings |
| ft_memchr | Scan memory for a character |
| ft_memcmp | Compare memory areas |
| ft_strnstr | Locate a substring in a string |
| ft_atoi | Convert ASCII string to integer |
| Function | Description |
|---|---|
| ft_strdup | Create a duplicate of a string |
| ft_calloc | Allocate memory and set to zero |
| ft_substr | Extract substring from string |
| ft_strjoin | Concatenate two strings |
| ft_strtrim | Trim characters from string |
| ft_split | Split string using a delimiter |
| ft_itoa | Convert integer to ASCII string |
| ft_strmapi | Apply function to each char of string |
| ft_striteri | Apply function to each char of string with index |
| ft_putchar_fd | Output char to given file descriptor |
| ft_putstr_fd | Output string to given file descriptor |
| ft_putendl_fd | Output string with newline to file descriptor |
| ft_putnbr_fd | Output number to given file descriptor |
| Function | Description |
|---|---|
| ft_lstnew | Create new list node |
| ft_lstadd_front | Add node at beginning of list |
| ft_lstsize | Count elements in list |
| ft_lstlast | Get last node of list |
| ft_lstadd_back | Add node at end of list |
| ft_lstdelone | Delete node with given function |
| ft_lstclear | Delete sequence of nodes |
| ft_lstiter | Apply function to content of all nodes |
| ft_lstmap | Apply function and create new list |
- GCC compiler
- Make
- Clone the repository:
git clone https://github.com/Hataxen/libft libft- Enter the project directory:
cd libft- Compile the library:
makeThis will create libft.a
- Include the header in your C files:
#include "libft.h"- When compiling your programs with the library:
gcc your_program.c -L. -lft- The Makefile includes basic tests
- Run
make testto execute them - Additional testing can be done using your own test files
This project follows the 42 norm rules, including:
- Functions under 25 lines
- No more than 5 functions per file
- Only allowed functions are write, malloc, and free
Mario Arjona
This project is part of 42 school curriculum.