/libft

This project is your very first project as a student at 42. You will need to recode a few functions of the C standard library as well as some other utility functions that you will use during your whole cursus.

Primary LanguageCOtherNOASSERTION

libft

C programming can be very tedious when one doesn’t have access to the highly useful standard functions.
This project is about understanding the way these functions work, implementing and learning to use them.
Your will create your own library.
It will be helpful since you will use it in your next C school assignments.
Take the time to expand your libft throughout the year.
However, when working on a new project, don’t forget to ensure the functions used in your library are allowed in the project guidelines.

subject v.15

Project Structure πŸ“‚
β”œβ”€β”€ README.md
β”œβ”€β”€ LICENSE
β”œβ”€β”€ Dockerfile
β”œβ”€β”€ libft
β”‚   β”œβ”€β”€ Makefile
β”‚   β”œβ”€β”€ include
β”‚   β”‚   └── libft.h
β”‚   └── src
β”‚       β”œβ”€β”€ algo
β”‚       β”‚   β”œβ”€β”€ ft_lds.c
β”‚       β”‚   └── ft_lis.c
β”‚       β”œβ”€β”€ fd
β”‚       β”‚   β”œβ”€β”€ ft_exit.c
β”‚       β”‚   β”œβ”€β”€ ft_putchar_fd.c
β”‚       β”‚   β”œβ”€β”€ ft_putendl_fd.c
β”‚       β”‚   β”œβ”€β”€ ft_putnbr_fd.c
β”‚       β”‚   └── ft_putstr_fd.c
β”‚       β”œβ”€β”€ _get_next_line
β”‚       β”‚   └── ft_get_next_line.c
β”‚       β”œβ”€β”€ hex
β”‚       β”‚   β”œβ”€β”€ ft_hexlen.c
β”‚       β”‚   β”œβ”€β”€ ft_ultoa_hex.c
β”‚       β”‚   └── ft_utoa_hex.c
β”‚       β”œβ”€β”€ is
β”‚       β”‚   β”œβ”€β”€ ft_isalnum.c
β”‚       β”‚   β”œβ”€β”€ ft_isalpha.c
β”‚       β”‚   β”œβ”€β”€ ft_isascii.c
β”‚       β”‚   β”œβ”€β”€ ft_isdigit.c
β”‚       β”‚   └── ft_isprint.c
β”‚       β”œβ”€β”€ mem
β”‚       β”‚   β”œβ”€β”€ ft_bzero.c
β”‚       β”‚   β”œβ”€β”€ ft_calloc.c
β”‚       β”‚   β”œβ”€β”€ ft_free.c
β”‚       β”‚   β”œβ”€β”€ ft_memchr.c
β”‚       β”‚   β”œβ”€β”€ ft_memcmp.c
β”‚       β”‚   β”œβ”€β”€ ft_memcpy.c
β”‚       β”‚   β”œβ”€β”€ ft_memmove.c
β”‚       β”‚   └── ft_memset.c
β”‚       β”œβ”€β”€ _printf
β”‚       β”‚   β”œβ”€β”€ ft_printf_assembly_line.c
β”‚       β”‚   β”œβ”€β”€ ft_printf.c
β”‚       β”‚   β”œβ”€β”€ ft_printf_format.c
β”‚       β”‚   └── lst
β”‚       β”‚       β”œβ”€β”€ t_print_add_back.c
β”‚       β”‚       β”œβ”€β”€ t_print_add_front.c
β”‚       β”‚       β”œβ”€β”€ t_print_add_inside.c
β”‚       β”‚       β”œβ”€β”€ t_print_del_last.c
β”‚       β”‚       β”œβ”€β”€ t_print_last.c
β”‚       β”‚       β”œβ”€β”€ t_print_new.c
β”‚       β”‚       β”œβ”€β”€ t_print_size.c
β”‚       β”‚       └── t_print_split_str.c
β”‚       └── str
β”‚           β”œβ”€β”€ ft_atoi.c
β”‚           β”œβ”€β”€ ft_char_append.c
β”‚           β”œβ”€β”€ ft_itoa.c
β”‚           β”œβ”€β”€ ft_n_is_in_arr.c
β”‚           β”œβ”€β”€ ft_split.c
β”‚           β”œβ”€β”€ ft_split_substr.c
β”‚           β”œβ”€β”€ ft_strappend.c
β”‚           β”œβ”€β”€ ft_strchr.c
β”‚           β”œβ”€β”€ ft_strdup.c
β”‚           β”œβ”€β”€ ft_stridx.c
β”‚           β”œβ”€β”€ ft_striteri.c
β”‚           β”œβ”€β”€ ft_strjoin.c
β”‚           β”œβ”€β”€ ft_strlcat.c
β”‚           β”œβ”€β”€ ft_strlcpy.c
β”‚           β”œβ”€β”€ ft_strlen.c
β”‚           β”œβ”€β”€ ft_strmapi.c
β”‚           β”œβ”€β”€ ft_strncmp.c
β”‚           β”œβ”€β”€ ft_strnstr.c
β”‚           β”œβ”€β”€ ft_strrchr.c
β”‚           β”œβ”€β”€ ft_strrev.c
β”‚           β”œβ”€β”€ ft_strtrim.c
β”‚           β”œβ”€β”€ ft_substr.c
β”‚           β”œβ”€β”€ ft_tolower.c
β”‚           β”œβ”€β”€ ft_toupper.c
β”‚           └── ft_utoa.c
└── _subject
    └── en.subject.pdf

πŸ“Œ - Key Topics

Standard Library

Implementing a collection of functions from the C standard library (libc) with the same prototypes and behaviors as the originals, prefixed with "ft_". This includes functions for character classification, string manipulation, memory management, and conversion. Functions to implement include:

  • Character Functions: isalpha, isdigit, isalnum, isascii, isprint, toupper, tolower
  • String Functions: strlen, strchr, strrchr, strncmp, strnstr, atoi
  • Memory Functions: memset, bzero, memcpy, memmove, memchr, memcmp
  • Memory Allocation Functions: calloc, strdup (using malloc)

πŸ› οΈ - Usage

git clone https://github.com/kichkiro/libft.git
cd libft/
docker build -t libft:42 .
docker run -d --name libft libft:42
docker cp libft:/usr/src/app/libft/libft.a .

The static library libft.a is now in the current dir, so it can be included in C code.

βš–οΈ - License

See LICENSE