Recode the printf() function to learn about variadic functions and improve your C programming skills.
This project involves recreating the libc's printf() function. This will introduce you to variadic functions in C, a critical skill for handling functions that accept an indefinite number of arguments. Implementing this function will help you understand more about handling different data types and formatting output.
- The project must be coded in C and conform to the coding norm.
- Handle memory properly - no leaks are tolerated.
- Submit a Makefile that compiles your project with appropriate flags and does not relink.
- Do not implement buffer management like the original printf().
Your implementation of ft_printf() must handle the following conversions: c, s, p, d, i, u, x, X, and %.
%c
Prints a single character.%s
Prints a string.%p
Prints a void * pointer in hexadecimal format.%d
and%i
Print a signed integer in base 10.%u
Prints an unsigned decimal (base 10) number.%x
Prints a number in hexadecimal (base 16) lowercase.%X
Prints a number in hexadecimal (base 16) uppercase.%%
Prints a percent sign.
For those who complete the mandatory part perfectly, the bonus part includes handling flags and minimum field widths under all conversions.
- Flags: '-', '0', '.', '#', '+', and ' '(space).
Compile the library using the Makefile provided, ensuring all rules like all
, clean
, fclean
, and re
are present to manage the library properly.