int printf (char * format,
... );
printf will convert an
arbitrary number of parameters and using the format string assign those into a
string and send them to the serial port (SOUT)
format may be a simple string in which case that string is printed
or it can contain parameters to be filled with values
%c -- replace this with a single character
%s -- replace this with a string
%d -- replace with a decimal value
%x -- replace with a hexadecimal value (%X upshifts A-F)
%u -- replace with the unsigned decimal value
In addition there are modifiers to further control the output string
%#d -- where # indicates how many characters will be used to represent the value -- in this case the value is right justified and blank filled
%0#x -- in this case the number is right justified but 0 filled for # total spaces
%-#s -- this left justifies the string and fills the right side with spaces
NOTE:- the printf.c library generates 2 warnings on "dereferencing type-punned pointer will break strict-aliasing rules"
printf ("%c", 0x31 ); // will display 1
printf ("%d", 1 ); // will display 1
printf ("%9d", 1 ); // will display " 1"
printf ("%-9d", 1 ); // will display "1 "
printf ("%09d", 1 ); // will display "0000000001"
printf ("%9s", "1" ); // will display " 1"