Command: printf, fprintf, sprintf
Syntax: flags, field_width, .precision, conversion_character
Flags:
· '-' - Left justify the result.
· '+' - Begin signed results with either + or -.
· ' ' - If no sign is used, use space.
· '0' - For d,i,o,u,x,X,e,E,f,g & G leading 0's will be used.
Field Width:
Used for unsigned integers. If the converted value has fewer chars than the
field width, it will be padded with spaces, unless the '-' flag has been used.
.Precision:
This depends on the conversion character.
· 'e','E','f' - Number of digits to appear after decimal point.
· 'g','G' - Number of significant digits to be output.
· 's' - Maximum number of characters to be output.
· 'd','i','o','u','x','X' - Minimum number of digits to appear.
Conversion Character:
· 'd','i' - Integer.
· 'o','u','x','X' - Octal.
· 'f' - Signed decimal.
· 'e','E' - Standard form notation.
· 'g','G' - Output as 'f', 'e' or 'E'.
· 'c' - Unsigned char.
· 's' - String.
· 'p' - Address of the pointer.
· 'n' - Number of chars written so far.
|
|
|