printf format commands:

Code    Format

%c      Character
%d      Signed decimal integer
%i      Signed decimal integer
%e      Scientific notation with lowercase e
%E      Scientific notation with uppercase E
%f      Decimal floating point
%g      Uses %e or %f, whichever is shorter
%G      Uses %E or %f, whichever is shorter
%o      Unsigned octal
%s      String of characters
%u      Unsigned decimal integer
%x      Unsigned hexadecimal with lowercase letters
%X      Unsigned hexadecimal with uppercase letters
%p      Displays a pointer
%n      The associated argument shall be an integer pointer which receives the number of characters written at this point
%%      Prints a % sign


The other writeups demonstrate some of these. Also check out the C backslash codes for useful printf formatting information. This information is taken from Teach Yourself C, 2nd ed. by Herbert Schildt.

Please realize that your first argument to printf should always be a constant with a format string. If you don't, you are putting incorrect code into your program. Why? Because printf always looks for these format codes in the first argument it is passed. If your first argument is a variable (potentially supplied by the user), then printf will evaluate whatever data is in it for format commands opening you up to potential irregular behavior of the function and possible security breach. This is bad and has been the cause of several security errors.