/42cursus-libft

set of useful functions and various libraries in c

Primary LanguageC

42cursus' libft

Development repo for 42cursus' libft project
For further information about 42cursus and its projects, please refer to 42 Cloneg7 repo.

GitHub code size in bytes Number of lines of code Code language count GitHub top language GitHub last commit


🗣️ About

The aim of this project is to code a C library regrouping usual functions that you'll be allowed to use in all your other projects.

For detailed information, refer to the subject of this project.

🚀 TLDR: this project consists of coding basic C functions (see below), which are then compiled
into a library for use in other projects of the cursus.

Functions from <ctype.h> library

Functions from <stdlib.h> library

  • ft_atoi - convert ASCII string to integer.
  • ft_atof * - convert ASCII string to integer.
  • ft_calloc - memory allocation.

Functions from <strings.h> library

Functions from <string.h> library

  • ft_strlen - find length of string.
  • ft_strlen_2 * - find length of 2D array (i.e. splitted string).
  • ft_strchr - locate character in string (first occurrence).
  • ft_strrchr - locate character in string (last occurence).
  • ft_strstr * - locate a substring in a string.
  • ft_strnstr - locate a substring in a string (size-bounded).
  • ft_strcmp * - compare strings.
  • ft_strncmp * - compare strings (size-bounded).
  • ft_strnrcmp - reversely compare strings (size-bounded).
  • ft_strcpy * - copy strings.
  • ft_strncpy * - copy strings (size-bounded).
  • ft_strdup - save a copy of a string (with malloc).
  • ft_strndup * - save a copy of a string (with malloc, size-bounded).
  • ft_strcat * - concatenate strings (s2 into s1).
  • ft_strncat * - concatenate strings (s2 into s1, size-bounded).
  • ft_strlcpy - size-bounded string copying.
  • ft_strlcat - size-bounded string concatenation.

Functions from <math.h> library

Non-standard functions

  • ft_swap * - swap value of two integers.
  • ft_putchar * - output a character to stdout.
  • ft_putchar_fd - output a character to given file.
  • ft_putstr * - output string to stdout.
  • ft_putstr_fd - output string to given file.
  • ft_putendl * - output string to stdout with newline.
  • ft_putendl_fd - output string to given file with newline.
  • ft_putnbr * - output integer to stdout.
  • ft_putnbr_fd - output integer to given file.
  • ft_itoa - convert integer to ASCII string.
  • ft_substr - extract substring from string.
  • ft_strtrim - trim beginning and end of string with the specified characters.
  • ft_strjoin - concatenate two strings into a new string (with malloc).
  • ft_split - split string, with specified character as delimiter, into an array of strings.
  • ft_split_free * - free splitted string.
  • ft_strmapi - create new string from modifying string with specified function.
  • ft_ftoa_rnd - convert float to ASCII string.

Linked list functions

Note: functions marked with * are bonus functions (not mandatory by the project's subject).

📑 Index

@root

  • 📁 libft: updated source code, refactored for use in other projects; includes get_next_line and printf functions.
  • 📁 submX folder(s): source code submitted to the cursus (including failed and succeeded submissions).