Reimplementation of the C standard library printf function from scratch, as part of the 42 curriculum.
ft_printf replicates the behavior of printf with support for multiple format specifiers. The project focuses on variadic functions, format string parsing, and memory-efficient character output.
| Specifier | Description |
|---|---|
%c |
Single character |
%s |
String |
%d / %i |
Signed decimal integer |
%u |
Unsigned decimal integer |
%x / %X |
Hexadecimal (lower / upper) |
%p |
Pointer address |
%% |
Literal % |
- Language: C
- Key concepts: variadic functions (
va_list,stdarg.h), format string parsing, low-level output viawrite(2)
ft_printf(format, ...)
→ scan format string character by character
→ on '%': identify specifier → convert argument → write output
→ return total number of characters written
| Field | Value |
|---|---|
| Project | ft_printf |
| Circle | 1 |
| Norminette | Compliant |
- How variadic functions work in C (
stdarg.h) - Modular dispatch: one entry point routing to type-specific conversion functions
- Low-level output management with
writeand byte counting