In this introductory project, I am excited to create my own personal static library in the C programming language. This project marks the beginning of my journey at campus19 and provides an opportunity to dive into C programming concepts while building a fundamental software component.
The project is called libft and is an exercise that requires you to use many things learnt during the piscine. Most of the functions in this project were written during the piscine (in one form or another).
Once I finished the libft project, I started rewriting some of the functions and makefile to use the library in other projects. The current state of the project is not what I submitted to moulinette. All updates after 18 January 2024 might not pass the moulinette because of changes in some functions and rules in the makefile.
ft_strlen
: calculates the length of a stringft_memset
: writes a certain amount of bytes (len) of value c to string bft_memcpy
: copies certain amount of bytes (n) from src ro dstft_memmove
: copies a certain amount of bytes (len) from src to dst (there may be overlap)ft_strlcpy
: copies up to dstsize -1 from src to dst and null-terminates the new string (returns the string it tried to create so length of src)ft_strlcat
: concatenates src to the end of dst and makes sure the new string is not longer than size to prevent buffer overflowft_strchr
: searches if c is in the string and returns a pointer to the first cft_strrchr
: searches if c is in a string and returns a pointer to the last cft_strncmp
: compares a maximum of n characters of s1 and s2 and returns the difference in ASCII valueft_memchr
: searches a memory block forc(converted to unsigned char) and returns a pointer to the byteft_memcmp
: compares s1 and s2 up to n characters and returns the difference in ASCII valueft_strnstr
: this looks for a substring in a string and returns a pointer to the substringft_strdup
: duplicates a string and returns a pointer to the new string
ft_bzero
: writes n-bytes of 0 to a string s
ft_isalpha
: checks if c is alphabeticalft_isdigit
: checks if c is a digitft_isalnum
: checks if c is a digit or alphabeticalft_isascii
: checks if c is an ASCII valueft_isprint
: checks if c is a printale characterft_toupper
: converts c to uppercaseft_tolower
: converts c to lowercase
ft_atoi
: converts string to integerft_calloc
: allocates memory for a number of elements and sets that memory to 0
ft_substr
: creates and returns a substring from a stringft_strjoin
: creates a new string by concatenating s1 and s2ft_strtrim
: removes characters specified in set from start and end in s1ft_split
: creates a new array of strings from an existing string using a separatorft_itoa
: converts an int to a stringft_strmapi
: creates a new string by applying a function to each character in an existing stringft_striteri
: applies a function to each character in a string and modifying it if necessaryft_putchar_fd
: outputs c to the file descriptorft_putstr_fd
: outputs a string to the file descriptorft_putendl_fd
: outputs a string to the file descriptor, followed by a newlineft_putnbr_fd
: outputs an int n to the file descriptor
ft_lstnew
: creates a new node in a linked listft_lstadd_front
: adds a new node to the front of an existing linked listft_lstsize
: returns the size of a linked listft_lstlast
: returns the last node in a linked listft_lstadd_back
: adds a node to the back of a linked listft_lstdelone
: takes del function as parameter and frees the memory of a node's content and frees the nodeft_lstclear
: clears a list by deleting and freeing every node in a linked listft_lstiter
: iterates the linked list and applies the function f on the content of each nodeft_lstmap
: creates a new linked list by applying the function f to the content of each node