This project is about coding a C library. It will contain a lot of general purpose functions your programs will rely upon.
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. You will create your own library. It will be helpful since you will use it in your next C school assignments.
Take the time to expand your libft throughout the year. However, when working on a new project, don’t forget to ensure the functions used in your library are allowed in the project guidelines.
- Your project must be written in C.
- Your project must be written in accordance with the Norm. If you have bonus files/functions, they are included in the norm check and you will receive a 0 if there is a norm error inside.
- Your functions should not quit unexpectedly (segmentation fault, bus error, double free, etc) apart from undefined behaviors. If this happens, your project will be considered non-functional and will receive a 0 during the evaluation.
- All heap allocated memory space must be properly freed when necessary. No leaks will be tolerated.
- If the subject requires it, you must submit a Makefile which will compile your source files to the required output with the flags
-Wall
,-Wextra
, and-Werror
, usecc
, and your Makefile must not relink. - Your Makefile must at least contain the rules
$(NAME)
,all
,clean
,fclean
, andre
. - To turn in bonuses to your project, you must include a rule
bonus
to your Makefile, which will add all the various headers, libraries or functions that are forbidden on the main part of the project. Bonuses must be in a different file_bonus.{c/h}
if the subject does not specify anything else. - Submit your work to your assigned git repository. Only the work in the git repository will be graded.
The mandatory part involves implementing a set of functions from the C standard library (libc
). These functions will be prefixed with ft_
(e.g., strlen
becomes ft_strlen
). You will also implement functions like calloc
and strdup
using dynamic memory allocation.
Implement the following functions:
isalpha
isdigit
isalnum
isascii
isprint
strlen
memset
bzero
memcpy
memmove
strlcpy
strlcat
toupper
tolower
strchr
strrchr
strncmp
memchr
memcmp
strnstr
atoi
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
The bonus part will be assessed only if the mandatory part is perfect. It involves working with linked lists and adding functions to manipulate them.
Implement the following functions for your list implementation:
ft_lstnew
ft_lstadd_front
ft_lstsize
ft_lstlast
ft_lstadd_back
ft_lstdelone
ft_lstclear
ft_lstiter
ft_lstmap