Libft is a project from 42 school aimed at recreating part of the C standard library. This project helps to better understand the workings of libc functions and acquire essential skills in C programming.
Libft is a custom library written in C, composed of various functions for string manipulation, memory management, and linked list handling.
- Reimplementation of standard C library (
libc) functions. - Additional functions to facilitate common operations in C.
- Support for linked lists as an extension.
To use libft, simply clone the repository and compile the library.
git clone https://github.com/garcia2/42_Libft
cd 42_Libft
makeThis will generate a libft.a file that you can link to your projects.
Include the header file libft.h in your project, then compile your code by linking the library.
#include "libft.h"
// Example usage
int main(void) {
char *str = ft_strdup("Hello, 42!");
ft_putstr_fd(str, 1);
free(str);
return 0;
}To compile:
gcc -Wall -Wextra -Werror main.c -L. -lft -o my_programft_calloc,ft_memset,ft_bzero,ft_memcpy,ft_memmove,ft_memchr,ft_memcmpft_strlen,ft_strdup,ft_strcpy,ft_strncatft_strchr,ft_strrchr,ft_strnstr,ft_strncmpft_atoi,ft_isalpha,ft_isdigit,ft_isalnum,ft_isascii,ft_isprintft_toupper,ft_tolower
ft_striteri,ft_substr,ft_strjoin,ft_strtrim,ft_strlcat,ft_split,ft_itoa,ft_strmapift_putchar_fd,ft_putstr_fd,ft_putendl_fd,ft_putnbr_fd
ft_lstnew,ft_lstadd_front,ft_lstsize,ft_lstlast,ft_lstadd_backft_lstdelone,ft_lstclear,ft_lstiter,ft_lstmap
Project developed by Nicolas Garcia as part of 42 school.