This project involves the reimplementation of the printf() function in C, offering a practical exploration of variadic functions.
int ft_printf(const char *, ...);| Function | Description |
|---|---|
malloc |
Allocate memory |
free |
Free allocated memory |
write |
Write to a file descriptor |
va_start |
Initialize a va_list |
va_arg |
Access variable arguments in va_list |
va_copy |
Copy a va_list |
va_end |
End using variable arguments in va_list |
Here is the list of implemented conversions:
%cPrints a single character.%sPrints a string (as defined by the common C convention).%pThe void * pointer argument has to be printed in hexadecimal format.%dPrints a decimal (base 10) number.%iPrints an integer in base 10.%uPrints an unsigned decimal (base 10) number.%xPrints a number in hexadecimal (base 16) lowercase format.%XPrints a number in hexadecimal (base 16) uppercase format.%%Prints a percent sign.
| Flag | Description |
|---|---|
| # | Alternate form for certain conversions |
| + | Always include a sign (+ or -) for numerical output |
| ' ' | If no sign is going to be written, a blank space is inserted before the value. |
