The control-string argument to format is actually a format control . That is, it can be either a format string or a function , for example a function returned by the formatter macro . If it is a function , the function is called with the appropriate output stream as its first argument and the data arguments to format as its remaining arguments. The compilation process performed by formatter produces a function that would do with its arguments as the format interpreter would do with those arguments . The remainder of this section describes what happens if the control-string is a format string .
Most directives use one or more elements of args to create their output.
A directive consists of a tilde , optional prefix parameters separated by commas, optional colon and at-sign modifiers, and a single character indicating what kind of directive this is. There is no required ordering between the at-sign and colon modifier. The case of the directive character is ignored. In this case, format takes an argument from args as a parameter to the directive. The argument should be an integer or character .