Skip to content

Latest commit

Β 

History

History
110 lines (84 loc) Β· 2.02 KB

File metadata and controls

110 lines (84 loc) Β· 2.02 KB

Libft

This project is part of the 42 Prague curriculum.
The goal of libft is to reimplement a set of standard C library functions as well as additional utilities.
The result is a custom C library that can be reused in later 42 projects.

πŸ“¦ Installation & Compilation

  1. Clone the repository:
git clone git@github.com:ylam21/libft.git libft
cd libft
  1. Compile the library:
make

This will produce the libft.a static library.

🧹 Makefile Rules

make – Compile the library

make clean – Remove object files (.o)

make fclean – Remove object files and the compiled library (libft.a)

make re – Recompile everything (equivalent to fclean + make)

πŸš€ Usage

  1. Include the header in your source file:
#include "libft.h"
  1. Compile your program with the library:
gcc -Ilibft your_program.c -Llibft -lft -o a.out

-Ilibft tells the compiler where to find libft.h

-Llibft tells the linker where to find libft.a

-lft links the library

πŸ“‘ Functions

βœ… Reimplemented libc functions

  • isalpha
  • isdigit
  • isalnum
  • isascii
  • isprint
  • strlen
  • memset
  • bzero
  • memcpy
  • memmove
  • strlcpy
  • strlcat
  • toupper
  • tolower
  • strchr
  • strrchr
  • strncmp
  • memchr
  • memcmp
  • strnstr
  • atoi
  • calloc
  • strdup
  • ft_substr
  • ft_strjoin
  • ft_strtrim
  • ft_split
  • ft_itoa
  • ft_strmapi
  • ft_striteri
  • ft_putchar_fd
  • ft_putstr_fd
  • ft_putendl_fd
  • ft_putnbr_fd

πŸ—οΈ Bonus part – Linked list functions

  • ft_lstnew
  • ft_lstadd_front
  • ft_lstsize
  • ft_lstlast
  • ft_lstadd_back
  • ft_lstdelone
  • ft_lstclear
  • ft_lstiter
  • ft_lstmap

πŸ“ Notes

This library will be used as a foundation for future 42 projects.

Functions follow the 42 norminette coding standard.

Each function is prefixed with ft_ to avoid naming conflicts with the standard library.