previous | start | next

The printf functions

 int printf(const char format_str[], ...)
 int fprintf(FILE *fp, const char format_str[], ...)
 int sprintf(char output_str[], const char format_str[], ...)
   

The format string can contain 0 or more format specifications mixed with ordinary characters to be output.

Format specifications are replaced by a converted value.

For each format specification, the parameter list should contain a value to be converted and inserted in place of the format spec.

Some format specifications

Format Specifier Meaning
%d Convert an integer value (to decimal using digits 0 - 9)
%x Convert an integer value (to hex using 0 - 9 and A - F)
%s "convert" a string value (really no conversion needed)

Between the percent sign and the conversion letter, you can have



previous | start | next