Skip to content

The aim of this project is to code a C library regrouping usual functions. ๐Ÿš€

Notifications You must be signed in to change notification settings

All3yp/Libft-42

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

53 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

42cursus - Libft

About

This project allows students to work with the basics of the language. Pointers, memory allocation, operations with data structures, as well as the creation of header and Makefile files.

The purpose of this project is to re-code some libc functions, as well as other common utility functions to be reused in the subsequent 42 projects.

Note: this Makfile doesnt compiled on Molinette. You need to make it as simple as possible, without any customization.

Grade and Badge

gradelibft

Clone

Open a terminal and run following command:

git clone <repository url>

Run

Go to the created repository and run following command:

make

or

make bonus

How to use

Make sure libft.a and libft.h are in the same directory that you want to call the functions from. Include libft.h in your files

#include "libft.h"

Compile your files with libft.a

gcc yourfile_01.c yourfile_02.c libft.a

Use clean to delete all object files, fclean to remove all object files and libft.a and re to recompile the library

make clean / make fclean / make re

Explanations

Functions from <ctype.h> library

Functions from <stdlib.h> library

Functions from <strings.h> library

Functions from <string.h> library

  • ft_strlen - find length of string.
  • ft_strchr - locate character in string (first occurrence).
  • ft_strrchr - locate character in string (last occurence).
  • ft_strnstr - locate a substring in a string (size-bounded).
  • ft_strncmp * - compare strings (size-bounded).
  • ft_strdup - save a copy of a string (with malloc).
  • ft_strlcpy - size-bounded string copying.
  • ft_strlcat - size-bounded string concatenation.

Other functions

  • ft_putchar_fd - output a character to given file.
  • ft_putstr_fd - output string to given file.
  • ft_putendl_fd - output string to given file with newline.
  • 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_strmapi - create new string from modifying string with specified function.
  • ft_striteri - applies a function to each character of the string passed as argument.

Additional Bonus Functions - Linked List


The lst-funtcions allow you to manipulate and use lists. Lists are quiet useful if you dont know the final length of an array because you can just append as many nodes as you until you run out of memory.

typedef struct		s_list
{
	void		*content;
	struct s_list	*next;
}	       		t_list;

Testing the Library

There is different script created by 42 students around the world to test many cases on your functions

Tripouille
Libft war machine
Libft-unit-test

About

The aim of this project is to code a C library regrouping usual functions. ๐Ÿš€

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published