Skip to content

Basic specifiers handle

Compare
Choose a tag to compare
@sebaslherrera sebaslherrera released this 29 Oct 15:44
· 26 commits to master since this release
54069bd

Writes the C string pointed by format to the standard output (stdout).

Prototype: int _printf(const char *format, ...);

Returns: the number of characters printed (excluding the null byte used to end output to strings)
write output to stdout, the standard output stream

format is a character string. The format string is composed of zero or more directives. See man 3 printf for more detail. You need to handle the following conversion specifiers:
c --> Character
s --> String of characters
% --> A % followed by another % character will write a single % to the stream.
d or i --> Signed decimal integer
b --> The unsigned int argument is converted to binary
u --> Unsigned decimal integer
o --> Unsigned octal
x --> Unsigned hexadecimal integer
X --> Unsigned hexadecimal integer (uppercase)

Docs --> http://www.cplusplus.com/reference/cstdio/printf/