The goal of this project was pretty straightforward. We had to recode
printf()
, in order to learn on the way how to handle a variable number of arguments.
%c
Prints a single character.%s
Prints a string (as defined by the common C convention).%p
The void * pointer argument has to be printed in hexadecimal format.%d
Prints a decimal (base 10) number.%i
Prints an integer in base 10.%u
Prints an unsigned decimal (base 10) number.%x
Prints a number in hexadecimal (base 16) lowercase format.%X
Prints a number in hexadecimal (base 16) uppercase format.%%
Prints a percent sign.
- One
Makefile
- One header file:
ft_printf.h
- Two
.c
files that contain the main code of 8 functions in total:ft_printf.c
that has the 3 main functionsprinting_functions.c
that has the 5 functions that print the wanted output in the Standard Output using thewrite()
command.
paco --strict
was handled also, apart from simplefrancinette
/paco
.
[In order to do that, I had to protect everywrite()
return, and that's why I use theint writefail;
.]static
was used to limit the scope of helper functions only inside theft_printf.c
file, since the 5 functions ofprinting_functions.c
file are all called outside of that file.- No memory allocation was used in the project.