Back

GitHub


Libft

Summary

Is an individual project that requieres to create a C library for future projects, it has some re-implemented standard C functions, and other non-standar functions. We get a deeper understanding of data structures and basic algorithms. During the cursus we are only allowed to use functions that we have programed, so we have to keep growing this libary with anything we would find useful.

char*
ft_strjoin(const char *s1, const char *s2)
{
	size_t	total;
	char	*str;

	total = ft_strlen(s1) + ft_strlen(s2) + 1;
	str = ft_calloc(total, 1);
	if (!str)
		return (NULL);
	ft_strlcat(str, s1, total);
	ft_strlcat(str, s2, total);
	return (str);
}

Introduction

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. Your 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

Mandatory part

Write your own library: a collection of functions that will be a useful tool for your cursus.

Technical considerations

Libc function

To begin, you must redo a set of functions from the libc. Your functions will have the same prototypes and implement the same behaviors as the originals. They must comply with the way they are defined in their man. The only difference will be their names. They will begin with the ’ft_’ prefix. For instance, strlen becomes ft_strlen.

Additional function

In this second part, you must develop a set of functions that are either not in the libc, or that are part of it but in a different form.

Bonus part

If you completed the mandatory part, do not hesitate to go further by doing this extra one. It will bring bonus points if passed successfully. Functions to manipulate memory and strings is very useful. But you will soon discover that manipulating lists is even more useful.


Libc functionsAdditional functionsBonus Functions
memsetft_memallocft_lstnew
bzeroft_memdelft_lstdelone
memcpyft_strnewft_lstdel
memccpyft_strdelft_lstadd
memmoveft_strclrft_lstiter
memchrft_striterft_lstmap
memcmpft_striteri
strlenft_strmap
strdupft_strmapi
strcpyft_strequ
strncpyft_strnequ
strcatft_strsub
strlcatft_strjoin
strchrft_strtrim
strrchrft_strsplit
strstrft_itoa
strnstrft_putchar
strcmpft_putstr
strncmpft_putendl
atoift_putnbr
isalphaft_putchar_fd
isdigitft_putstr_fd
isalnumft_putendl_fd
isasciift_putnbr_fd
isprint
toupper
tolower