Home

Search IconIcon to open search

printf

A School 21 project.

# Useful

Return value of built-in printf is the number of characters printed (returned). If an error occurred, the value is negative.

# To-do

# Notes

Variadic functions in C are dangerous. In case of type mismatch or wrong number of arguments the program crashes. See this and this questions on Stack Overflow.

In case of too many (or to few) arguments, passed to the built-in printf, a warning is raised. Though with flags -Wall -Werror -Wextra it won’t even compile. In case of argument type mismatch, I think the behavior is undefined.

# Things from man 3 printf

The format string is composed of zero or more directives: ordinary characters (not %), which are copied unchanged to the output stream; and conversion specifications, each of which results in fetching zero or more subsequent arguments. Each conversion specification is introduced by the character %, and ends with a conversion specifier. In between there may be (in this order) zero or more flags, an optional minimum field width, an optional precision and an optional length modifier.