Reimplementation of the standard printf function in C, developed as part of the 42 School curriculum.
The goal of this project is to implement a simplified version of the printf function from the C standard library. This custom implementation handles various format specifiers and uses variadic functions.
This version of ft_printf supports the following conversions:
| Format | Description |
|---|---|
%c |
Character |
%s |
String |
%d |
Signed decimal integer |
%i |
Signed decimal integer |
%u |
Unsigned decimal integer |
%x |
Unsigned hexadecimal (lowercase) |
%X |
Unsigned hexadecimal (uppercase) |
%p |
Pointer address |
Header File: ft_printf.h
Defines the public function prototype and helper functions.
ft_printf.cβ Main implementation of theft_printffunctionft_putstr.cβ String printing and character outputft_int_number.cβ Integer formattingft_hexnumber.cβ Hexadecimal formattingft_unsigned.cβ Unsigned integer formattingft_pointer.cβ Pointer address formattingft_step.cβ Helper function for number-to-string conversion steps
#include "ft_printf.h"
int main(void)
{
int num = 42;
ft_printf("Hello, number: %d\n", num);
return (0);
}