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.
- Subject
PDF
- References
GitHub
git clone [email protected]:jotavare/ft_printf.git
cd ft_printf/ft_printf
make
#include "ft_printf.h"
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
.
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;
- Manage any combination of the following flags:
-O
and the field minimum width under all conversions; - Manage all the following flags:
#
+
;
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
If you find any issues or have suggestions for improvements, feel free to fork the repository and open an issue or submit a pull request.
This project is available under the MIT License. For further details, please refer to the LICENSE file.