I made this list a while ago (I'm not really sure if I made all of it, but I do remember choking on some things, but then again...my memory isn't all that reliable), it may be outdated already, but I find it to be useful, so maybe you will too.

These can be used in any ANSI compliant printf/scanf function, unless mentioned otherwise.

Valid conversion types:
  d    decimal notation
  i    decimal notation (new ANSI standard extension)
  o    octal notation
  x    hexadecimal notation
  X    hexadecimal notation (upper-case)
  u    unsigned notation
  c    character notation
  s    string notation (argument must be char *)

  f    floating point notation (normal, fixed-point)
  e    floating point notation (exponential)
  E    floating point notation (exponential, upper-case)
  g    floating point notation (either normal or exponential)
  G    floating point notation (normal or exponential, upper-case)

  p    value of a pointer
  n    number of characters printed so far (outputs to argument)
  m    string corresponding to value of errno (GNU extension)
  %    literal `%' character

Each of these is used following a percent sign to indicate the type of output conversion desired. The following fields may be added between those two characters.

 -     left justification in its field
 (n)   a number specifying minimum field width
 .     to separate n from m
 (m)   significant fractional digits for a float

Integer type modifiers:
 l     to indicate a long
 h     to indicate a short
 L     to indicate a long long
 ll    same as L
 q     same as L
 Z     indicate size_t (GNU extension)

Floating point type modifiers:
 L         indicate long double

General number modifiers:
 +         print `+' if value of %i,%d or %f is positive
 <spc> print ` ' if %i,%d or %f does not start with `+' or `-'
 #         for %o prefix leading zero, for %x/%X prefix `0x'/`0X'
           for %f always add `.'
 '         seperate digits into groups (GNU extension)
 0         pad field with zeros instead of spaces

Log in or register to write something here or to contact authors.