Skip to content

Libft is a project where we recreate some of the standard functions of the C language, in order to form our own library.

License

Notifications You must be signed in to change notification settings

mendes-jv/libft

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Libft: Create you own C library

Norminette and Build 42 São Paulo License Code size in bytes Top language Last commit

Index:

Grade:

jovicto2's 42 Libft Score

Description:

Libft is the first project at 42 programming school, and it consists on recreate some of the standard functions of the C language, in order to form our own library. The library can be used as a support in future school's projects, since it's not allowed to use the original functions. Once you finish the project, you can (and should) include more functions to Libft than previously asked.

The project:

Functions from <ctype.h>

Functions from <string.h>

Functions from <stdlib.h>

  • ft_atoi - converts a string to an integer
  • ft_calloc - allocates memory and sets its bytes' values to 0

Non-standard functions

  • ft_substr - returns a substring from a string
  • ft_strjoin - concatenates two strings
  • ft_strtrim - trims the beginning and end of string with specific set of chars
  • ft_split - splits a string using a char as parameter
  • ft_itoa - converts a number into a string
  • ft_strmapi - applies a function to each character of a string
  • ft_striteri - applies a function to each character of a string
  • ft_putchar_fd - outputs a char to a file descriptor
  • ft_putstr_fd - outputs a string to a file descriptor
  • ft_putendl_fd - outputs a string to a file descriptor, followed by a new line
  • ft_putnbr_fd - outputs a number to a file descriptor

Linked list functions (Libft's Project Bonus Part)

  • ft_lstnew - creates a new list element
  • ft_lstadd_front - adds an element at the beginning of a list
  • ft_lstsize - counts the number of elements in a list
  • ft_lstlast - returns the last element of a list
  • ft_lstadd_back - adds an element at the end of a list
  • ft_lstclear - deletes and free list
  • ft_lstiter - applies a function to each element of a list
  • ft_lstmap - applies a function to each element of a list and returns a new list with the return of all nodes iteration

Functions from others 42 projects

Functions added after finishing the project

  • ft_lputaddress_fd - outputs an address and returns its length
  • ft_lputbin_fd - outputs a number in binary representation and returns its length
  • ft_lputdouble_fd - outputs a double number and returns its length
  • ft_lputhexa_fd - outputs a number in hexadecimal representation and returns its length
  • ft_lputnbr_fd - outputs a integer and returns its length
  • ft_lputoctal_fd - outputs a number in octal representation and returns its length
  • ft_lputstr_fd - outputs a string and returns its length
  • ft_itoa_base - converts a number in a string and applies the number system specified
  • ft_itoa_hex - converts a number in a string and converts it to hexadecimal base
  • ft_ptoa - converts an address in a string
  • ft_ctoa - converts a single char in a string (char + '\0' termination)
  • ft_check_string - checks if a string is a null pointer and returns "(null)" if it is

How to execute:

First, clone this repository and cd into it:

git clone https://github.com/mendes-jv/libft && cd libft

Compile the library with:

make

Now you have a file called libft.a, use any function of the libft and compile your code with the archive.

[gcc | cc | clang] [flags] main.c libft.a && ./a.out

About

Libft is a project where we recreate some of the standard functions of the C language, in order to form our own library.

Topics

Resources

License

Stars

Watchers

Forks

Packages