format specifiers that can be used in printf()

Tuesday, October 14, 2014
  • The following are all the format specifiers that can be used in printf():
    • %c The character format specifier.
    • %d The integer format specifier.
    • %i The integer format specifier (same as %d).
    • %f The floating-point format specifier.
    • %e The scientific notation format specifier (note the lowercase e).
    • %E The scientific notation format specifier (note the uppercase E).
    • %g Uses %f or %e, whichever result is shorter.
    • %G Uses %f or %E, whichever result is shorter.
    • %o The unsigned octal format specifier.
    • %s The string format specifier.
    • %u The unsigned integer format specifier.
    • %x The unsigned hexadecimal format specifier (note the lowercase x).
    • %X The unsigned hexadecimal format specifier (note the uppercase X).
    • %p Displays the corresponding argument that is a pointer.
    • %n Records the number of characters written so far.
    • %% Outputs a percent sign (%).

Copyright @ 2015 Tron!

Labels

Blog Archive