RatmirGR / libft

This project is your very first project as a student at 42. Here we need to rewrite a few functions of the C standard library, as well as some other helper functions

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

libft

This project is about coding the C library, more specifically creating our own library. Its main purpose is to get an idea of ​​how the standard functions work, how they are implemented, and where they can be used.

The project contains 43 functions:

= 23 functions from the standard library:

  • ft_isalpha - checks if a character is an alphabetic letter
  • ft_isdigit - checks if a character is a number
  • ft_isalnum - Checks if a character is an alphabetic letter or a number
  • ft_isascii - checks if a character is an ascii character
  • ft_isprint - Checks if a character is a printable character
  • ft_strlen - returns the size of the string
  • ft_memset - fills a memory area with the specified character
  • ft_bzero - fills memory area with 0 (zeros)
  • ft_memcpy - copies contents (non-overlapping) from one memory area to another
  • ft_memmove - copies contents from one memory area to another
  • ft_strlcpy - copies a string
  • ft_strlcat - copies a string
  • ft_toupper - convert characters to upper case
  • ft_tolower - converts characters to lowercase
  • ft_strchr - searches for the first occurrence of the character c in the string pointed to by the argument str
  • ft_strrchr - searches for the last occurrence of the character c in the string pointed to, by the argument str
  • ft_strncmp - compares at most the first n bytes of str1 and str2
  • ft_memchr - searches for the first occurrence of the character c in the first n bytes of the string pointed to, by the argument str
  • ft_memcmp - compares the first n bytes of memory area str1 and memory area str2
  • ft_strnstr - locates the first occurrence of the null-terminated string "little" in the null-terminated string "big"
  • ft_atoi - converts the string argument str to an integer
  • ft_calloc - allocates the requested memory, sets the allocated memory to zero, and returns a pointer to it
  • ft_strdup - returns a pointer to a null-terminated byte string, which is a duplicate of the string pointed to by str1

= 11 functions for working with character strings, which are either not in the libc library, or they have a different shape

  • ft_substr - allocates and returns a substring from the string ’s’. The substring begins at index ’start’ and is of maximum size ’len’
  • ft_strjoin - allocates and returns a new string, which is the result of the concatenation of ’s1’ and ’s2’
  • ft_strtrim - allocates and returns a copy of ’s1’ with the characters specified in ’set’ removed from the beginning and the end of the string
  • ft_split - allocates and returns an array of strings obtained by splitting ’s’ using the character ’c’ as a delimiter
  • ft_itoa - allocates and returns a string representing the integer received as an argument
  • ft_strmapi - applies the function ’f’ to each character of the string ’s’, and passing its index as first argument to create a new string resulting from successive applications of ’f’
  • ft_striteri - applies the function ’f’ on each character of the string passed as argument, passing its index as first argument. Each character is passed by address to ’f’ to be modified if necessary
  • ft_putchar_fd - outputs the character ’c’ to the given file descriptor
  • ft_putstr_fd - outputs the string ’s’ to the given file descriptor
  • ft_putendl_fd - outputs the string ’s’ to the given file descriptor followed by a newline
  • ft_putnbr_fd - outputs the integer ’n’ to the given file descriptor

= 9 functions for working with linked lists:

  • ft_lstadd_back - adds the node ’new’ at the end of the list
  • ft_lstadd_front - adds the node ’new’ at the beginning of the list
  • ft_lstclear - deletes and frees the given node and every successor of that node, using the function ’del’ and free
  • ft_lstdelone - takes as a parameter a node and frees the memory of the node’s content using the function ’del’ given as a parameter and free the node
  • ft_lstiter - iterates the list ’lst’ and applies the function ’f’ on the content of each node
  • ft_lstlast - returns the last node of the list
  • ft_lstmap - iterates the list ’lst’ and applies the function ’f’ on the content of each node
  • ft_lstnew - allocates and returns a new node
  • ft_lstsize - counts the number of nodes in a list

About

This project is your very first project as a student at 42. Here we need to rewrite a few functions of the C standard library, as well as some other helper functions


Languages

Language:C 95.3%Language:Makefile 4.7%