This project is about coding a C library. 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. It will contain a lot of general purpose functions future programs of the 42 cursus will rely upon.
Grade : 125/100
Subjects v.16.1 : FR
EN
42 Norm v.4 : FR
EN
ft_isalpha
- checks for an alphabetic characterft_isdigit
- checks for a digit (0 through 9).ft_isalnum
- checks for an alphanumeric characterft_isascii
- checks whether c fits into the ASCII character setft_isprint
- checks for any printable characterft_toupper
- converts char to uppercaseft_tolower
- converts char to lowercase
ft_memset
- fills memory with a constant byteft_strlen
- calculates the length of a stringft_bzero
- zeroes a byte stringft_memcpy
- copies memory areaft_memmove
- copies memory area without overlappingft_strlcpy
- copies string to a specific sizeft_strlcat
- concatenates string to a specific sizeft_strchr
- locates character in stringft_strrchr
- locates character in stringft_strncmp
- compares two stringsft_memchr
- scans memory for a characterft_memcmp
- compares memory areasft_strnstr
- locates a substring in a stringft_strdup
- creates a duplicate for the string passed as parameter
ft_atoi
- converts a string to an integerft_calloc
- allocates memory and sets its bytes' values to 0
ft_substr
- returns a substring from a stringft_strjoin
- concatenates two stringsft_strtrim
- trims the beginning and end of string with specific set of charsft_split
- splits a string using a char as parameterft_itoa
- converts a number into a stringft_strmapi
- applies a function to each character of a stringft_striteri
- applies a function to each character of a stringft_putchar_fd
- outputs a char to a file descriptorft_putstr_fd
- outputs a string to a file descriptorft_putendl_fd
- outputs a string to a file descriptor, followed by a new lineft_putnbr_fd
- outputs a number to a file descriptor
ft_lstnew
- creates a new list elementft_lstadd_front
- adds an element at the beginning of a listft_lstsize
- counts the number of elements in a listft_lstlast
- returns the last element of a listft_lstadd_back
- adds an element at the end of a listft_lstclear
- deletes and free listft_lstiter
- applies a function to each element of a listft_lstmap
- applies a function to each element of a list and returns a new list with the return of all nodes iteration
make
ormake all
- compile library libft.a without bonus functionsmake bonus
- compile library libft.a with bonus functionsmake clean
- remove all object filesmake fclean
- remove all object files and library libft.amake re
- remove all object files and library libft.a, and recompile library without bonus
After compiling the library libft.a, include the header in your code :
#include "libft.h"
Compile your main.c
code using
[ gcc | clang | cc ] main.c -I path/to/libft.h -L path/to/libft.a -lft
Alternatively, if your main.c
file is located at the root of this repository :
[ gcc | clang | cc ] main.c libft.a
I recommend you to code your own tests and compare your function to the existing libc function when you can. It is not only an important part of the learning process but also allows to properly imitate the behaviour of the libc that your system uses. Those are third-party tester to run complementary tests, use them at your own risk.
- Tripouille libftTester
- alelievr libft-unit-test
- 0x050f libft-war-machine
- xicodomingues francinette