| `%d` | Decimal representation: Display a value as a base 10 (hence the decimal) integer. |
| `%f` | Fixed point decimal representation. Specify the number of places to round to by adding a decimal and a number, eg `%.2f` would round to two decimal places. |
`X`: The type of format to use, and the end of the specifier. Use `d` for integer base 10 (decimal) representation, `f` for fixed point decimal, and `e` for exponential notation, and `g` to select between fixed point and exponential, whichever is shorter.
Used to write a string to stdout with the ability to format variables into the string.
Write a string to standard output. `f` indicates that it's a formatting string. The string will not include move the cursor to a newline, append `\n` to the end of the string to do so.
Printf accepts a variable number of arguments, the first argument is the formatting string, then following arguments are the arguments to be inserted into the string.
The format of the input is specified using [formatting specifiers](#Formatting%20specifiers), and all following arguments are pointers pointing to variables to update.
For each formatting specifier specified in the string, `scanf` will attempt to locate an appropriate value in the input, skipping whitespace and newlines if necessary until the beginning of a number is reached.
When asked to read an integer, `scanf` searches for one of:
- A digit
- A plus or minus sign
It will continue to read until it reaches a nondigit (whitespace is not skipped in this case, and it is counted as a nondigit). If it doesn't encounter a valid digit first, it will return early.
When asked to read a float, `scanf` searches for one of:
- A series of digits (possibly containing a decimal point), followed by an exponent (optional). An exponent consists of the letter `e` or `E`, an optional sign, and one or more digits.
`%e`, `%f`, and `%g` all follow the same rules for recognizing floating point numbers.
If an ordinary character is included in the pattern matching string, it will be matched then discarded before proceeding to the next character.