This is our printf right here done in pair programming with the vscode live share pluginmade 100% from scratch!
well appart from some functions.
int _printf(const char *format, ...);
where format
can be a simple string without any specifiers or it can contain specifiers and the arguments corresponding to them.
specifier | argument type |
---|---|
%d | Print int |
%i | Same as %d |
%c | Print char |
%s | Print string |
%b | Print unsigned int as binary |
%u | Print unsigned int |
%o | Print unsigned int as octal |
%x | Print unsigned int as hexadecimal with lowercase |
%X | Print unsigned int as hexadecimal with uppercase |
Check out the Man Page for detailed usage.
This is the main function file containing the main logic.
This file contains the functions to handle each argument type.
This file contains some general purpose functions some are clones of standard c functions.
Thet test directory contains the different tests in test.c format.
To run tests do:
./exec.sh [test name]
check exec.sh to see the tests format.
- write
- malloc
- free
- va_start
- va_end
- va_copy
- va_arg