Skip to content
PAYTheVendettaPublic

About

mi libreia

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

libft

Custom implementation of the C standard library, built from scratch as part of the 42 Madrid curriculum.

This library serves as the foundation for all future C projects at 42 — no external functions allowed, everything reimplemented by hand.


Project Structure

libft/
├── src/        # Mandatory functions
├── bonus/      # Linked list functions
├── includes/   # libft.h header
├── Makefile
└── README.md

Functions

Character Checks & Conversions

Function Description
ft_isalpha Checks if character is alphabetic
ft_isdigit Checks if character is a digit
ft_isalnum Checks if character is alphanumeric
ft_isascii Checks if character is ASCII
ft_isprint Checks if character is printable
ft_toupper Converts character to uppercase
ft_tolower Converts character to lowercase

String Manipulation

Function Description
ft_strlen Returns the length of a string
ft_strchr Locates a character in a string
ft_strrchr Locates last occurrence of a character
ft_strncmp Compares two strings up to n characters
ft_strnstr Finds a substring in a string
ft_strdup Duplicates a string
ft_substr Extracts a substring
ft_strjoin Concatenates two strings
ft_strtrim Trims characters from both ends of a string
ft_split Splits a string by a delimiter
ft_strmapi Applies a function to each character
ft_striteri Applies a function to each character with index
ft_strlcpy Copies a string with size limit
ft_strlcat Concatenates strings with size limit

Memory Management

Function Description
ft_memset Fills memory with a constant byte
ft_bzero Zeroes out memory
ft_memcpy Copies memory area
ft_memmove Moves memory area safely
ft_memchr Scans memory for a character
ft_memcmp Compares two memory areas
ft_calloc Allocates and zeroes memory

Conversions

Function Description
ft_atoi Converts a string to integer
ft_itoa Converts an integer to string

File Descriptor Output

Function Description
ft_putchar_fd Writes a character to a file descriptor
ft_putstr_fd Writes a string to a file descriptor
ft_putendl_fd Writes a string followed by newline
ft_putnbr_fd Writes an integer to a file descriptor

Linked List (Bonus)

Function Description
ft_lstnew Creates a new list node
ft_lstadd_front Adds a node at the beginning
ft_lstadd_back Adds a node at the end
ft_lstsize Returns the number of nodes
ft_lstlast Returns the last node
ft_lstdelone Deletes a single node
ft_lstclear Deletes all nodes
ft_lstiter Applies a function to each node
ft_lstmap Creates a new list from applying a function

Usage

Compilation

make        # compile mandatory part
make bonus  # compile with linked list functions
make clean  # remove object files
make fclean # remove object files and libft.a
make re     # full rebuild

Using in your project

#include "libft.h"
gcc main.c -L. -lft -o program

Author

Aitor Alonso Jusdado — 42 Madrid — LinkedIn

About

mi libreia

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages