jotavare / ft_printf

Redo the behavior of C library function printf without using it.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Linkedin 42

AboutHow to useMandatoryBonusNorminetteLicense

ABOUT

This project involved recreating the well-known C library function, printf. This provided a valuable learning opportunity in variadic arguments and structures, particularly if we intend to incorporate additional flags into our implementation of print.

HOW TO USE

1º - Clone the repository

git clone git@github.com:jotavare/ft_printf.git

2º - Enter the project folder and run make

cd ft_printf/ft_printf
make

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

#include "ft_printf.h"

MAKEFILE RULES

make or make all - Compile ft_printf files.

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

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

make re - Use rules fclean + all.

MANDATORY

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 percentage sign;

BONUS

  • Manage any combination of the following flags: -O and the field minimum width under all conversions;
  • Manage all the following flags: # +;

NORMINETTE

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

- No for, do...while, switch, case, goto, ternary operators, or variable-length arrays 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, with 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 to respect the code norm, made by 42. GitHub
  • 42 Header - 42 header for Vim. GitHub

LICENSE

This work is published under the terms of Unlicense.

About

Redo the behavior of C library function printf without using it.

License:MIT License


Languages

Language:C 95.5%Language:Makefile 4.5%