/Libft

This project is about coding a C library. It will contain a lot of general purpose functions your programs will rely upon.

Primary LanguageCOtherNOASSERTION


Libft

โ—ฆ Your very first own library

42 Barcelona

GitHub%20Actions GitHub code size GitHub top language

๐Ÿ“– Table of Contents


๐Ÿ“ Overview

The Libft project involves creating a C library containing a wide range of general-purpose functions to support your programs. These functions emulate the behavior of standard C library functions but are prefixed with "ft_".


๐Ÿ“ฆ Features

Libc Functions: Reimplementation of standard C library functions with names prefixed by "ft_". ft_isalpha, ft_isdigit, ft_isalnum, ft_isascii, ft_isprint, ft_strlen, ft_memset, ft_bzero, ft_memcpy, ft_memmove, ft_strlcpy, ft_strlcat, ft_toupper, ft_tolower, ft_strchr, ft_strrchr, ft_strncmp, ft_memchr, ft_memcmp, ft_strnstr, ft_atoi

Additional Functions: Extended functionality for string manipulation. 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

Linked List Functions: Additional functions for working with linked lists. ft_lstnew, ft_lstadd_front, ft_lstsize, ft_lstlast, ft_lstadd_back, ft_lstdelone, ft_lstclear, ft_lstiter, ft_lstmap


๐Ÿ“‚ Repository Structure

โ””โ”€โ”€ Libft/
    โ”œโ”€โ”€ Makefile
    โ”œโ”€โ”€ ft_atoi.c
    โ”œโ”€โ”€ ft_bzero.c
    โ”œโ”€โ”€ ft_calloc.c
    โ”œโ”€โ”€ ft_isalnum.c
    โ”œโ”€โ”€ ft_isalpha.c
    โ”œโ”€โ”€ ft_isascii.c
    โ”œโ”€โ”€ ft_isdigit.c
    โ”œโ”€โ”€ ft_isprint.c
    โ”œโ”€โ”€ ft_itoa.c
    โ”œโ”€โ”€ ft_lstadd_back_bonus.c
    โ”œโ”€โ”€ ft_lstadd_front_bonus.c
    โ”œโ”€โ”€ ft_lstclear_bonus.c
    โ”œโ”€โ”€ ft_lstdelone_bonus.c
    โ”œโ”€โ”€ ft_lstiter_bonus.c
    โ”œโ”€โ”€ ft_lstlast_bonus.c
    โ”œโ”€โ”€ ft_lstmap_bonus.c
    โ”œโ”€โ”€ ft_lstnew_bonus.c
    โ”œโ”€โ”€ ft_lstsize_bonus.c
    โ”œโ”€โ”€ ft_memchr.c
    โ”œโ”€โ”€ ft_memcmp.c
    โ”œโ”€โ”€ ft_memcpy.c
    โ”œโ”€โ”€ ft_memmove.c
    โ”œโ”€โ”€ ft_memset.c
    โ”œโ”€โ”€ ft_putchar_fd.c
    โ”œโ”€โ”€ ft_putendl_fd.c
    โ”œโ”€โ”€ ft_putnbr_fd.c
    โ”œโ”€โ”€ ft_putstr_fd.c
    โ”œโ”€โ”€ ft_split.c
    โ”œโ”€โ”€ ft_strchr.c
    โ”œโ”€โ”€ ft_strdup.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_strtrim.c
    โ”œโ”€โ”€ ft_substr.c
    โ”œโ”€โ”€ ft_tolower.c
    โ”œโ”€โ”€ ft_toupper.c
    โ””โ”€โ”€ libft.h

โš™๏ธ Modules

Root
File Summary
libft.h Header file with function prototypes
Makefile Makefile for compiling the library
Libc functions
File Summary
ft_toupper.c Convert character to uppercase
ft_tolower.c Convert character to uppercase
ft_strrchr.c Locate character in string from the end
ft_strnstr.c Locate substring in string
ft_strncmp.c Compare two strings up to a specified number of characters
ft_strlen.c Calculate the length of a string
ft_strlcpy.c Copy a string to a specified size
ft_strlcat.c Concatenate strings with a specified size
ft_strdup.c Duplicate a string with malloc
ft_strchr.c Locate character in string
ft_memset.c Fill memory with a constant byte
ft_memmove.c Copy memory area
ft_memcpy.c Copy memory area
ft_memcmp.c Compare memory areas
ft_memchr.c Locate byte in byte string
ft_isprint.c Check if a character is printable
ft_isdigit.c Check if a character is a digit
ft_isascii.c Check if a character is an ASCII character
ft_isalpha.c Check if a character is an alphabet character
ft_isalnum.c Check if a character is alphanumeric
ft_calloc.c Allocate and zero-initialize array
ft_bzero.c Set a byte string to zero
ft_atoi.c Convert a string to an integer
Additional functions
File Summary
ft_substr.c Extract substring from string
ft_strjoin.c Concatenate two strings
ft_strtrim.c Trim leading and trailing a character from a string
ft_split.c Split a string into an array of substrings
ft_itoa.c Convert an integer to a string
ft_strmapi.c Apply a function to each character of a string
ft_striteri.c Apply a function to each character of a string with its index
ft_putstr_fd.c Output a string to a file descriptor
ft_putnbr_fd.c Output an integer to a file descriptor
ft_putendl_fd.c Output a string to a file descriptor, followed by a newline
ft_putchar_fd.c Output a character to a file descriptor
Bonus
File Summary
ft_lstsize_bonus.c Count the number of elements in a list
ft_lstnew_bonus.c Create a new list element
ft_lstmap_bonus.c Apply a function to each element of a list and create a new list
ft_lstlast_bonus.c Return the last element of a list
ft_lstiter_bonus.c Apply a function to each element of a list
ft_lstdelone_bonus.c Delete a list element
ft_lstclear_bonus.c Delete and free a list
ft_lstadd_front_bonus.c Add a new element at the beginning of the list
ft_lstadd_back_bonus.c Add a new element at the end of the list

๐Ÿš€ Getting Started

๐Ÿ”ง Installation

  1. Clone the Libft repository:
git clone https://github.com/San-tito/Libft
  1. Change to the project directory:
cd Libft
  1. Compile the dependencies:
make

๐Ÿค– Use Libft

Once the library is successfully compiled, you can use it in your projects. Link the libft.a file to your program, and include the libft.h header in your source files. To compile your program with Libft, use:

gcc -o my_program my_program.c -L . -lft

๐Ÿงช Tests

/* Not implemented */

๐Ÿ›ฃ Roadmap

  • โ„น๏ธ Implement linked list functions.
  • โ„น๏ธ Continuous integration for automated testing.
  • โ„น๏ธ Explore opportunities for optimization.

๐Ÿค Contributing

Contributions are welcome! Here are several ways you can contribute:


๐Ÿ“„ License

This project is protected under the UNLICENSE License. For more details, refer to the LICENSE file.


๐Ÿ‘ Acknowledgments

Return