/ft_printf

Reverse engineering and recreation of the printf() function in C

Primary LanguageC

ft_printf

Reverse engineering and recreation of the printf() function in C

AboutUsageNorme

About

ft_printf consists in recreating the printf() function in C, and learning how it works, in order to be utilized in further projects. This projects introduces concepts such as variadic arguments and structures.

This ft_printf function supports several format specifiers, described below.

  • %c - Print a single character.
  • %s - Print a string.
  • %p - Print void * pointer argument in hexadecimal format.
  • %d - Print a decimal (base 10) number.
  • %i - Print an integer in base 10.
  • %u - Prints an unsigned decimal (base 10) number.
  • %x - Print a number in hexadecimal (base 16) lowercase format.
  • %X - Print a number in hexadecimal (base 16) uppercase format.
  • %% - Print a percent sign.

Usage

1st - Clone the repository

git@github.com:MartimPinto/ft_printf.git ft_printf

2nd - Enter the library folder and run Make

cd ft_printf/src
make

3rd - Include the header in your .c file

#include "ft_printf.h"

Norme

All 42 projects must be written following the Norme.

- No for, do while, switch, case or goto are allowed
- No more than 25 lines per function and 5 functions per file
- No assigns and declarations in the same line (unless static)
- Each line must be at most 80 columns wide, comments included
- A function can take 4 named parameters maximum
- No more than 5 variables in 1 function