printf — Output a formatted string
void printf(char *fmt, ...);
Print a formatted string to Gtuner IV output.
%-tag
specified in the format parameter. There should be the same number of these arguments as the number of %-tags
that expect a value.No value is returned.
The format tag prototype is: %[flags][width][.precision][length]specifier
flags | |
---|---|
- | Left-justify within the given field width. Right justification is the default. |
+ | Forces to precede the result with a plus or minus sign even for positive numbers. |
# | Used with o, x or X specifiers the value is preceded with 0, 0x or 0X respectively for values different than zero. Used with e, E and f, it forces the written output to contain a decimal point even if no digits would follow. |
0 | Left-pads the number with zeroes instead of spaces, where padding is specified. |
width | |
number | Minimum number of characters to be printed. |
* | The width is not specified in the format string, but as an additional integer value argument preceding the argument that has to be formatted. |
.precision | |
.number | For integer specifiers (d, i, o, u, x, X), precision specifies the minimum number of digits to be written. For e, E and f specifiers, this is the number of digits to be printed after the decimal point. |
.* | The precision is not specified in the format string, but as an additional integer value argument preceding the argument that has to be formatted. |
length | |
h | The argument is interpreted as a short int or unsigned short int. |
l | The argument is interpreted as a long int or unsigned long int. |
specifier | |
c or C | Character. |
d or i | Signed decimal integer. |
e | Scientific notation using e character. |
E | Scientific notation using E character. |
f | Decimal point. |
g | Uses the shorter of %e or %f. |
G | Uses the shorter of %E or %f. |
o | Signed octal. |
s or S | Pointer address of the string. Note: This specifier does not have the conventional expected behavior. |
u | Unsigned decimal integer. |
x | Unsigned hexadecimal integer. |
X | Unsigned hexadecimal integer with capital letters. |
p | Pointer address. |
n | Nothing printed. |
% | The % character. |
init { int ch; for(ch=85; ch<=100; ++ch) { printf("ASCII: %d, Character: %c", ch, ch); } }