A custom implementation of the C standard library printf function, developed as part of the 42 Bangkok curriculum.
The goal of this project is to recreate the core behavior of printf while learning how variadic functions work in C.
The implementation supports:
%c— character%s— string%p— pointer address%d— signed decimal integer%i— signed integer%u— unsigned decimal integer%x— lowercase hexadecimal%X— uppercase hexadecimal%%— percent sign
- Variadic functions with
va_list - Recursive number conversion
- Signed and unsigned integer handling
- Hexadecimal conversion
- Pointer formatting
- Static libraries
- Makefiles
- 42 Norm coding standard
makeThis creates the static library:
libftprintf.a
Include the header:
#include "ft_printf.h"Compile your program with the library:
cc main.c libftprintf.aExample:
ft_printf("Hello %s, number: %d\n", "42", 42);make
make clean
make fclean
make re- Builds successfully with
-Wall -Wextra -Werror - Passes Norminette
- Tested with characters, strings, signed integers, unsigned integers, hexadecimal values, pointers, and percent conversion
Kullatida Raksanaves
42 Bangkok