This project is an integral part of the 42 School curriculum, designed to deepen your understanding of the C programming language by creating a custom library of functions. The goal is to implement a set of standard C library functions, prefixed with "ft_", and to further enhance your library with bonus functions focused on linked list manipulation.
-
ft_isalpha
- Checks if a character is an alphabetic character.
-
ft_isdigit
- Checks if a character is a digit (0-9).
-
ft_isalnum
- Checks if a character is alphanumeric.
-
ft_isascii
- Checks if a character is within the ASCII character set.
-
ft_isprint
- Checks if a character is printable (including space).
-
ft_strlen
- Calculates the length of a string.
-
ft_memset
- Fills a block of memory with a specified value.
-
ft_bzero
- Sets the first n bytes of the memory area pointed to by s to zero.
-
ft_memcpy
- Copies n bytes from memory area src to memory area dest.
-
ft_memmove
- Copies n bytes from src to dest, handling overlapping memory.
-
ft_strlcpy
- Copies up to size - 1 characters from the NUL-terminated string src to dest.
-
ft_strlcat
- Appends the NUL-terminated string src to the end of dest.
-
ft_toupper
- Converts a lowercase letter to uppercase.
-
ft_tolower
- Converts an uppercase letter to lowercase.
-
ft_strchr
- Locates the first occurrence of a character in a string.
-
ft_strrchr
- Locates the last occurrence of a character in a string.
-
ft_strncmp
- Compares the first n characters of two strings.
-
ft_memchr
- Locates the first occurrence of c in the first n bytes of the string pointed to by s.
-
ft_memcmp
- Compares two memory blocks.
-
ft_strnstr
- Locates a substring in a string.
-
ft_atoi
- Converts a string to an integer.
-
ft_calloc
- Allocates memory for an array of nmemb elements of size bytes each and initializes the memory to zero.
-
ft_strdup
- Allocates sufficient memory for a copy of the string, does the copy, and returns a pointer to it.
-
ft_lstnew
- Allocates and returns a new element with the given content.
-
ft_lstadd_front
- Adds the element ’new’ at the beginning of the list.
-
ft_lstsize
- Counts the number of elements in a list.
-
ft_lstlast
- Returns the last element of the list.
-
ft_lstadd_back
- Adds the element ’new’ at the end of the list.
-
ft_lstdelone
- Takes as a parameter an element and frees the memory of the element’s content using the function ’del’ given as a parameter and free the element.
-
ft_lstclear
- Deletes and frees the given element and every successor of that element, using the function ’del’ and free.
-
ft_lstiter
- Iterates the list ’lst’ and applies the function ’f’ to the content of each element.
-
ft_lstmap
- Iterates the list ’lst’ and applies the function ’f’ to the content of each element. Creates a new list resulting from the successive applications of ’f’.
-
Clone the repository:
git clone https://github.com/your-username/libft.git
-
Navigate to the project folder:
cd libft
-
Compile the library:
make
This will generate the
libft.a
library. -
Use the library in your C projects:
-
Copy the
libft.a
file to your project folder. -
Include the
libft.h
header file in your C files. -
Compile your project with the library:
gcc -Wall -Wextra -Werror -o your_program your_file.c libft.a
-
-
Clean up:
make clean
This removes object files.
-
If you want to remove the library and object files:
make fclean