Printing output with format specifiers by using variadic arguments
Start date: 05/august/2021
Project status: completed 100/100 points
The aim of this project is to re-code
libc
's printf function with the conversions:
' c ', ' s ', ' p ', ' d ', ' i ', ' u ', ' x ', ' X ' and ' % '.
Requirements
• The function has to handle the following conversions: cspdiuxX%
• The function will be compared against the original printf()
• To create the library command ar must be used
• Don’t implement the buffer management of the original printf()
• Using the libtool command is forbidden
• Executable libftprintf.a has to be created at the root of your repository
Key learning points
- Handling variadic arguments
- Organising a complex project with various sub-functions & libraries in sub-directories
Specifier | Meaning |
---|---|
* [c ] |
Prints a single character |
* [s ] |
Prints a string (as defined by the common C convention) |
* [p ] |
The void * pointer argument has to be printed in hexadecimal format |
* [d ] |
Prints a decimal (base 10) number |
* [i ] |
Prints an integer in base 10 |
* [u ] |
Prints an unsigned decimal (base 10) number |
* [x ] |
Prints a number in hexadecimal (base 16) lowercase format |
* [X ] |
Prints a number in hexadecimal (base 16) uppercase format |
* [% ] |
Prints a percent sign |
Clone the repository:
git clone https://github.com/KHammerschmidt/42cursus-ft_printf &&
cd ft_printf &&
git clone https://github.com/KHammerschmidt/42cursus-Libft
To create library libftprintf.a: Create the library archive:
make