A custom Printf implementation from 42 School
Ft_printf is an individual project at 42 School that recreates the standard C printf
function from scratch. This project focuses on handling formatted output with essential specifiers and conversions, mastering variadic arguments, and ensuring robust string manipulation. It’s a key step in building foundational skills for the 42 curriculum.
The goal? Deliver a reliable, custom Printf
that mirrors the core functionality of the original.
%c
— Prints a single character.%s
— Prints a string.%p
— Prints a pointer address in hexadecimal.%d
/%i
— Prints a decimal integer (signed).%u
— Prints an unsigned decimal integer.%x
/%X
— Prints a hexadecimal integer (lowercase or uppercase).%%
— Prints a literal percent sign.
main.c
— Main file handling format string parsing and output.print.c
— Routes to the appropriate conversion function.utils.c
— Contains several functions that are useful and necessary for other files.
-
Clone repository
git clone git@github.com:doooriian/Ft_printf.git
-
Go inside project directory and run
make
cd Ft_printf make
-
To use the library in your code,
#include
the following header#include "printf.h"
This project was tested using Francinette, a widely-used third-party tester designed for 42 School projects, along with custom test cases to ensure compliance with the printf standard.
Here’s my score for the Ft_printf project:
Feel free to reach out or contribute to this project via GitHub!