ft_printf is a custom implementation of the standard printf function in C.
This project is part of the common core at École 42, and aims to develop a deep understanding of variadic functions, formatted output, and low-level C programming.
- Recreate the behavior of the C standard
printffunction - Handle variadic arguments with
va_list - Parse and process format specifiers
- Manage memory and edge cases without using the standard
printf
The following conversions are implemented:
| Specifier | Description |
|---|---|
%c |
Character |
%s |
String |
%p |
Pointer address (hexadecimal) |
%d |
Signed decimal integer |
%i |
Signed decimal integer |
%u |
Unsigned decimal integer |
%x |
Unsigned hexadecimal (lowercase) |
%X |
Unsigned hexadecimal (uppercase) |
%% |
Literal percent sign |
To compile the library and run example programs:
makeYou can include ft_printf.a in your own projects as follows:
#include "ft_printf.h"Link it during compilation:
gcc main.c libftprintf.aft_printf/
│
├── ft_printf.c # Entry point and dispatcher
├── utils/ # Helper functions (itoa, strlen, putchar, etc.)
├── conversions/ # Individual format specifier handling
├── ft_printf.h # Header file
├── Makefile # Build instructions
└── test/ # Optional test files
You can test the function with various inputs:
ft_printf("Hello %s, number: %d\n", "world", 42);You can also compare the output with the standard printf for consistency:
printf("Standard: %d\n", num);
ft_printf("Custom: %d\n", num);42 Login: hsilverb Contact: LinkedIn
This project is part of the 42 School curriculum.
For learning and academic use only.