Reimplementation of printf in C using variadic arguments (va_list, va_start, va_arg).
makecc main.c -L. -lftprintf -o program#include "ft_printf.h"
ft_printf("Hello, %s! You are %d years old.\n", name, age);
ft_printf("Pointer: %p\n", ptr);
ft_printf("Hex: %x / %X\n", 255, 255); // ff / FFThe format string is scanned character by character. When % is found, the next character determines which conversion to apply. Each conversion writes directly to stdout via write(). Returns the total number of characters printed, same as the real printf.
| Specifier | Output |
|---|---|
%c |
Single character |
%s |
String ((null) if NULL) |
%p |
Pointer address (0x + lowercase hex) |
%d / %i |
Signed decimal integer |
%u |
Unsigned decimal integer |
%x / %X |
Hex lowercase / uppercase |
%% |
Literal % |
├── ft_printf.h - prototypes
├── ft_printf.c - main function + format parser
├── ft_printf_utils1.c - %c, %s, %p
└── ft_printf_utils2.c - %d, %i, %u, %x, %X