Format Specifiers

%c character char
%d, %i integer int
%e, %E, %f, %F, %g, %G floating point float
%s String string
%o Octal unsigned int
%x, %X Hex unsigned int
%p pointer
%n number of characters written so far
%% Outputs a % sign


%5d integer, at least 5 wide
%7f floating point, at least 7 wide
%.3f floating point, with 3 decimal places after the point
%4.2 floating point, at least 4 wide and 2 decimal places

Leave a Reply