/libft

Prepare to join 1337

Primary LanguageCOtherNOASSERTION

AboutHow to useMandatoryBonusNorminetteLicense

ABOUT

The first project at 42, libft, involves learning how the standard functions of C programming work by writing them from scratch and creating a personal library. This project is vital as the library will be used in future assignments at 42.

If you're a 42 student, it's highly recommended that you go through the process of writing your own code and testing it yourself rather than copying and pasting code that you only partially understand. If you've successfully completed your piscine, there's no reason why you couldn't tackle this project on your own! Be patient and thorough.

Click here for the subject of this project.

HOW TO USE

COMPILATION

1º - Clone the repository

git clone git@github.com:MarouanDoulahiane/libft.git

2º - Enter the project folder and run make

cd libft/libft
make

3º - To use in your code, include the header

#include "libft.h"

MAKEFILE RULES

make - Compile libft mandatory files.

make bonus - Compile libft bonus files.

make all - Compile mandatory + bonus files.

make clean - Delete all .o (object files) files.

make fclean - Delete all .o (object file) and .a (executable) files.

make re - Use rules fclean + all.

MANDATORY

The mandatory functions in libft include both functions from the standard C library and other functions that are useful for character, string, and memory manipulation. These 34 mandatory functions are essential to achieving a grade of 100.

Check and manipulate characters:

  • ft_isalpha
  • ft_isdigit
  • ft_isalnum
  • ft_isascii
  • ft_toupper
  • ft_tolower

Manipulate strings:

  • ft_strlen
  • ft_strlcpy
  • ft_strlcat
  • ft_strchr
  • ft_strrchr
  • ft_strncmp
  • ft_strnstr
  • ft_substr
  • ft_strjoin
  • ft_strtrim
  • ft_split
  • ft_strmapi
  • ft_striteri

Manipulate memory:

  • ft_calloc
  • ft_memset
  • ft_bzero
  • ft_memcpy
  • ft_memmove
  • ft_memchr
  • ft_memcmp
  • ft_strdup

Manipulate numbers:

  • ft_atoi
  • ft_itoa

Write to a file descriptor:

  • ft_putchar_fd
  • ft_putstr_fd
  • ft_putendl_fd
  • ft_putnbr_fd

BONUS

The bonus functions in libft are focused on list manipulation and are worth an additional 25 towards the final grade. To achieve a grade of 125, all 9 bonus functions and 34 mandatory functions must be completed accurately.

  • ft_lstnew
  • ft_lstadd_front
  • ft_lstsize
  • ft_lstlast
  • ft_lstadd_back
  • ft_lstdelone
  • ft_lstclear
  • ft_lstiter
  • ft_lstmap

NORMINETTE

At 42 School, it is expected that almost every project is written in accordance with the Norm, which is the coding standard of the school.

- No for, do...while, switch, case, goto, ternary operators and variable-length arrays are allowed
- Each function must be a maximum of 25 lines, not counting the function's curly brackets
- Each line must be at most 80 columns wide, comments included
- A function can take 4 named parameters maximum
- No assigns and declarations in the same line (unless static)
- You can't declare more than 5 variables per function
- ...
  • 42 Norms - Information about 42 code norms. PDF
  • Norminette - Tool by 42, to respect the code norm. GitHub
  • 42 Header - 42 header for Vim. GitHub

LICENSE

This work is published under the terms of MIT LICENSE.