In this project we mimic the original printf() function.
its job is to output formatted data to the stdout more information on stdout (Standard Output Stream)
👇👇👇 Here is an example usage of the function 👇👇👇
- In this project we learn how to use Variadic Arguments or an amazing feature called "Ellipsis". this feature allows us to pass an unfixed amount of arguments to the function.
The prototype of ft_printf() is :
int ft_printf(const char *, ...);
in the prototype we can see the usage of the so-called Ellipsis by using the 3 dots (...) (more information on Variadic Arguments)
- The function can optionaly contain embedded "format specifiers" that are replaced by the values specified in subsequent additional arguments and formatted as requested.
A format specifier follows this prototype :
%[flags][width][.precision][length]specifier
In this project we only handle the following conversions: cspdiuxX%
(more information on format specifiers)
Compile the code using -> make all
of course we would need a main function, either write one inside the ft_printf.c
file or by creating a main file main.c
int main(void)
{
// Call the function
ft_printf("Testing!!");
return (0);
}
Compile the library that was created earlier with the main.c
:
gcc main.c libftprintf.a
Run the program :
./a.out
Output should be :
Testing!!