A recreation of essential C standard library functions, built from scratch as part of the 42 School curriculum.
Libft is your first project at 42. It involves recreating several functions from the C standard library, as well as additional utility functions that will be useful throughout your studies. This library serves as the foundation for all future C projects at 42.
- String manipulation functions:
ft_strlen,ft_strcpy,ft_strcat,ft_strcmp, etc. - Memory management functions:
ft_memset,ft_memcpy,ft_memcmp, etc. - Character checking functions:
ft_isalpha,ft_isdigit,ft_isalnum, etc. - Conversion functions:
ft_atoi,ft_itoa - Linked list functions:
ft_lstnew,ft_lstadd,ft_lstdel, etc.
makeThis will create a libft.a static library file.
- Clone the repository:
git clone https://github.com/bratzwitch/libft.git
cd libft- Compile the library:
make- Include in your project:
#include "libft.h"- Compile your program with the library:
gcc -Wall -Wextra -Werror your_file.c -L. -lft#include "libft.h"
#include <stdio.h>
int main()
{
char *str = "Hello, 42!";
printf("Length: %zu\n", ft_strlen(str));
char *dup = ft_strdup(str);
printf("Duplicate: %s\n", dup);
free(dup);
return (0);
}ft_memset,ft_bzero,ft_memcpy,ft_memccpy,ft_memmove,ft_memchr,ft_memcmpft_strlen,ft_strlcpy,ft_strlcat,ft_strchr,ft_strrchr,ft_strnstr,ft_strncmpft_atoi,ft_isalpha,ft_isdigit,ft_isalnum,ft_isascii,ft_isprintft_toupper,ft_tolower,ft_calloc,ft_strdup
ft_substr,ft_strjoin,ft_strtrim,ft_split,ft_itoa,ft_strmapi,ft_putchar_fd,ft_putstr_fd,ft_putendl_fd,ft_putnbr_fd
ft_lstnew,ft_lstadd_front,ft_lstsize,ft_lstlast,ft_lstadd_back,ft_lstdelone,ft_lstclear,ft_lstiter,ft_lstmap
- GCC compiler
- Make
Viacheslav Moroz - 42 Student