Standard C++ Library Reference ISO/IEC (VERSION3)
%G double x (double)x 10 6
%LG long double x (long double)x 10 6
%i int x (int)x 10 1
%hi int x (short)x 10 1
%li long x (long)x 10 1
%n int *x
%hn short *x
%ln long *x
%o int x (unsigned int)x 8 1
%ho int x (unsigned short)x 8 1
%lo long x (unsigned long)x 8 1
%p void *x (void *)x
%s char x[] x[0]... large
%ls wchar_t x[] x[0]... large
%u int x (unsigned int)x 10 1
%hu int x (unsigned short)x 10 1
%lu long x (unsigned long)x 10 1
%x int x (unsigned int)x 16 1
%hx int x (unsigned short)x 16 1
%lx long x (unsigned long)x 16 1
%X int x (unsigned int)x 16 1
%hX int x (unsigned short)x 16 1
%lX long x (unsigned long)x 16 1
%% none '%'
The print conversion specifier determines any behavior not summarized in this table. For all
floating-point conversions:
Positive infinity prints as inf or INF.●
Negative infinity prints as -inf or -INF.●
Not-a-number (NaN) prints as nan or NAN.●
The upper-case version prints only for an upper-case conversion specifier, such as %E but not
%Lg.
In the following descriptions, p is the precision. Examples follow each of the print conversion
specifiers. A single conversion can generate up to 509 characters.