The aim is to create our own printf from our understanding to the secrets of printf function.
Also to practice all what we learned from 0x00. C - Hello, World
to 0x10. C - Variadic functions
.
Title: Secrets of “printf”.
Author: Professor Don Colton.
Organization: Brigham Young University Hawaii.
Citation: Colton, D. (2015). Secrets of “printf”.
Link: Secrets_0f_Printf.
Tested on Ubuntu 20.04 LTS.
C files are complied using gcc 9.4.0.
C files are written according to the GNU C89 dialect, which includes some extensions beyond the standard C89.
All of the following files are programs written in C:
Filename | Description |
---|---|
_printf.c |
produces output according to a format. |
printf_char.c |
prints a character and returns its length. |
printf_string.c |
prints a string and returns its length. |
printf_37.c |
prints the character % and returns its length. |
_strlen.c |
calcules the length of a string. |
_putchar.c |
writes a character to stdout. |
main.h |
header file includes libraries, structures, and the prototypes of all functions used for this project. |
printf_dec_int.c |
prints an integer or decimal number and returns its length. |
printf_bin.c |
prints a binary representation for an unsigned integer and returns its length. |
printf_unsigned.c |
prints the returned unsigned data type. |
printf_oct.c |
a function that prints or returns octal number. |
printf_hex.c |
recalls hexadecimal numbers. |
printf_HEX.c |
recalls hexadecimal numbers (Uppercase). |
printf_exclusive_string.c |
String with hex-ascii value replaces special chars. |
printf_pointer.c |
prints the pointer address. |
Specifier | Description |
---|---|
c |
character. |
s |
string of characters. |
% |
character % . |
d |
decimal number. |
i |
integer. |
b |
binary. |
u |
unsigned. |
o |
octal. |
x |
hexadecimal. |
X |
hexadecimal(uppercase). |
S |
special chars |
p |
pointer address |
19818794
codatorex